From 04dcd09976ecc5aa2948993b9a9a2d90d239ee44 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 28 Jul 2011 10:58:07 +0000 Subject: Delete old beta3 branch as its going to be recreated from the current trunk git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1151789 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/rest/NotModifiedException.java | 44 - .../binding/rest/PreconditionFailedException.java | 44 - .../sca/binding/rest/RESTBindingCacheTestCase.java | 903 --------------------- .../sca/binding/rest/RESTBindingTestCase.java | 163 ---- .../sca/binding/rest/TestBindingCacheImpl.java | 199 ----- .../tuscany/sca/binding/rest/TestGetImpl.java | 37 - .../tuscany/sca/binding/rest/TestServiceImpl.java | 60 -- .../sca/binding/rest/rpc/EchoServiceTestCase.java | 145 ---- .../wireformat/binary/BinaryServiceTestCase.java | 106 --- .../wireformat/json/CatalogServiceTestCase.java | 150 ---- .../wireformat/xml/CustomerServiceTestCase.java | 123 --- .../test/java/services/binary/BinaryService.java | 45 - .../java/services/binary/BinaryServiceImpl.java | 57 -- .../src/test/java/services/customer/Customer.java | 70 -- .../java/services/customer/CustomerService.java | 49 -- .../services/customer/CustomerServiceImpl.java | 65 -- .../src/test/java/services/echo/Echo.java | 41 - .../src/test/java/services/echo/EchoImpl.java | 45 - .../src/test/java/services/store/Catalog.java | 51 -- .../java/services/store/CurrencyConverter.java | 29 - .../java/services/store/CurrencyConverterImpl.java | 38 - .../java/services/store/FruitsCatalogImpl.java | 76 -- .../src/test/java/services/store/Item.java | 50 -- .../src/test/java/services/store/Items.java | 37 - 24 files changed, 2627 deletions(-) delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/NotModifiedException.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/PreconditionFailedException.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTBindingCacheTestCase.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTBindingTestCase.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestBindingCacheImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestGetImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestServiceImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/rpc/EchoServiceTestCase.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/binary/BinaryServiceTestCase.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/binary/BinaryService.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/binary/BinaryServiceImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/Customer.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/CustomerService.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/CustomerServiceImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/echo/Echo.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/echo/EchoImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverter.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverterImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/FruitsCatalogImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Item.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Items.java (limited to 'sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java') diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/NotModifiedException.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/NotModifiedException.java deleted file mode 100644 index 49e7d67a76..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/NotModifiedException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package org.apache.tuscany.sca.binding.rest; - -/** - * Indicates that a resource was not modified. - * - * @version $Rev$ $Date$ - */ -public class NotModifiedException extends Exception { - private static final long serialVersionUID = -5046027674128627383L; - - public NotModifiedException() { - } - - public NotModifiedException(String message) { - super(message); - } - - public NotModifiedException(Throwable cause) { - super(cause); - } - - public NotModifiedException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/PreconditionFailedException.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/PreconditionFailedException.java deleted file mode 100644 index 1463e1a5db..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/PreconditionFailedException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package org.apache.tuscany.sca.binding.rest; - -/** - * Indicates that a resource was not modified. - * - * @version $Rev$ $Date$ - */ -public class PreconditionFailedException extends Exception { - private static final long serialVersionUID = -5046027674128627383L; - - public PreconditionFailedException() { - } - - public PreconditionFailedException(String message) { - super(message); - } - - public PreconditionFailedException(Throwable cause) { - super(cause); - } - - public PreconditionFailedException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTBindingCacheTestCase.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTBindingCacheTestCase.java deleted file mode 100644 index 4db7fd64dc..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTBindingCacheTestCase.java +++ /dev/null @@ -1,903 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ -package org.apache.tuscany.sca.binding.rest; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.Socket; -import java.text.MessageFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * HTTP binding unit tests. - * - * @version $Rev$ $Date$ - */ -public class RESTBindingCacheTestCase { - // RFC 822 date time - protected static final SimpleDateFormat dateFormat = new SimpleDateFormat( - "EEE, dd MMM yyyy HH:mm:ss Z"); - - // Request with no predicates in header. - private static final String REQUEST1 = "{0} /httpbinding/{1} HTTP/1.0\n" - + "Host: localhost\n" + "Content-Type: text/xml\n" - + "Connection: close\n" + "Content-Length: {2}" + "\n\n{3}"; - - // Request with predicates in header - private static final String REQUEST2 = "{0} /httpbinding/{1} HTTP/1.0\n" - + "Host: localhost\n" + "Content-Type: text/xml\n" + "{2}: {3}\n" // predicate (If-Match, If-None-Match, If-Modified-Since, If-NotModified-Since): value (date or ETag) - + "Connection: close\n" + "Content-Length: {4}" + "\n\n{5}"; - - private static final int HTTP_PORT = 8085; - - private static Node node; - - @BeforeClass - public static void setUp() throws Exception { - try { - String contribution = ContributionLocationHelper.getContributionLocation(RESTBindingCacheTestCase.class); - node = NodeFactory.newInstance().createNode("testCache.composite", new Contribution("test", contribution)); - node.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @AfterClass - public static void tearDown() throws Exception { - node.stop(); - } - - /** - * Test invoking a POJO get method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testGet() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST1, "GET", index, content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - Assert.assertTrue(document.indexOf("

item=" + index) != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalGetIfModifiedNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "GET", index, - "If-Modified-Since", dateFormat.format(new Date(0)), - content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("

item=" + index) != -1); - // Should return code 304 Not Modified. - // assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalGetIfModifiedPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "GET", index, - "If-Modified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("

item=" + index) != -1); - // Should return code 304 Not Modified. - Assert.assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalGetIfUnmodifiedNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "GET", index, - "If-Unmodified-Since", dateFormat.format(new Date()), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("

item=" + index) != -1); - // Should return code 304 Not Modified. - // assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalGetIfUnmodifiedPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "GET", index, - "If-Unmodified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("

item=" + index) != -1); - // Should return code 412 PreconditionFailed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalGetIfMatchNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "GET", index, - "If-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("

item=" + index) != -1); - // Should return code 412 precondition failed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalGetIfMatchPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "GET", index, - "If-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("

item=" + index) != -1); - // Should return code 412 PreconditionFailed. - // assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalGetIfNoneMatchNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "GET", index, - "If-None-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("

item=" + index) != -1); - // Should return code 412 precondition failed. - // assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalGetIfNoneMatchPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "GET", index, - "If-None-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("

item=" + index) != -1); - // Should return code 412 PreconditionFailed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a POJO get method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testDelete() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST1, "DELETE", index, - content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - Assert.assertTrue(document.indexOf("deleted item=" + index) != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalDeleteIfModifiedNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "DELETE", index, - "If-Modified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("deleted item=" + index) != -1); - // Should return code 304 Not Modified. - // assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalDeleteIfModifiedPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "DELETE", index, - "If-Modified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("deleted item=" + index) != -1); - // Should return code 304 Not Modified. - Assert.assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalDeleteIfUnmodifiedNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "DELETE", index, - "If-Unmodified-Since", dateFormat.format(new Date()), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("deleted item=" + index) != -1); - // Should return code 304 Not Modified. - // assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalDeleteIfUnmodifiedPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "DELETE", index, - "If-Unmodified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("deleted item=" + index) != -1); - // Should return code 412 PreconditionFailed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalDeleteIfMatchNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "DELETE", index, - "If-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("deleted item=" + index) != -1); - // Should return code 412 precondition failed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalDeleteIfMatchPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "DELETE", index, - "If-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("deleted item=" + index) != -1); - // Should return code 412 PreconditionFailed. - // assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalDeleteIfNoneMatchNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "DELETE", index, - "If-None-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("deleted item=" + index) != -1); - // Should return code 412 precondition failed. - // assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalDeleteIfNoneMatchPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "DELETE", index, - "If-None-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("deleted item=" + index) != -1); - // Should return code 412 PreconditionFailed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a POJO get method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testPost() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST1, "POST", index, content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - Assert.assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPostIfModifiedNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "POST", index, - "If-Modified-Since", dateFormat.format(new Date()), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return code 200 OK - // assertTrue(document.indexOf("posted item=" + index) != -1); - Assert.assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1); - // Should return code 304 Not Modified. - // assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPostIfModifiedPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "POST", index, - "If-Modified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("posted item=" + index) != -1); - // Should return code 304 Not Modified. - Assert.assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPostIfUnmodifiedNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "POST", index, - "If-Unmodified-Since", dateFormat.format(new Date()), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return code 200 OK - Assert.assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1); - // Should return code 304 Not Modified. - // assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPostIfUnmodifiedPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "POST", index, - "If-Unmodified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("posted item=" + index) != -1); - // Should return code 412 PreconditionFailed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPostIfMatchNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "POST", index, - "If-Match", "eTagMatch", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return code 200 OK. - Assert.assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1); - // Should return code 412 precondition failed. - // assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPostIfMatchPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat - .format(REQUEST2, "POST", index, "If-Match", "eTagNoneMatch", - content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("posted item=" + index) != -1); - // Should return code 412 PreconditionFailed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPostIfNoneMatchNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "POST", index, - "If-None-Match", "eTagNoneMatch", content.getBytes().length, - content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return code 200 OK - Assert.assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1); - // Should return code 412 precondition failed. - // assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPostIfNoneMatchPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "POST", index, - "If-None-Match", "eTagMatch", content.getBytes().length, - content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("posted item=" + index) != -1); - // Should return code 412 PreconditionFailed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a POJO get method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testPut() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST1, "PUT", index, content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - Assert.assertTrue(document.indexOf("updated item=" + index) != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPutIfModifiedNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "PUT", index, - "If-Modified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("updated item=" + index) != -1); - // Should return code 304 Not Modified. - // assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPutIfModifiedPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "PUT", index, - "If-Modified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("updated item=" + index) != -1); - // Should return code 304 Not Modified. - Assert.assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPutIfUnmodifiedNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "PUT", index, - "If-Unmodified-Since", dateFormat.format(new Date()), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("updated item=" + index) != -1); - // Should return code 304 Not Modified. - // assertTrue(document.indexOf("HTTP/1.1 304") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPutIfUnmodifiedPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "PUT", index, - "If-Unmodified-Since", dateFormat.format(new Date(0)), content - .getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("updated item=" + index) != -1); - // Should return code 412 PreconditionFailed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPutIfMatchNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "PUT", index, - "If-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("updated item=" + index) != -1); - // Should return code 412 precondition failed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPutIfMatchPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "PUT", index, - "If-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("updated item=" + index) != -1); - // Should return code 412 PreconditionFailed. - // assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPutIfNoneMatchNegative() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 1; - String content = ""; - String request = MessageFormat.format(REQUEST2, "PUT", index, - "If-None-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - Assert.assertTrue(document.indexOf("updated item=" + index) != -1); - // Should return code 412 precondition failed. - // assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Test invoking a conditional method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testConditionalPutIfNoneMatchPositive() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String content = ""; - String request = MessageFormat.format(REQUEST2, "PUT", index, - "If-None-Match", "eTagXXX", content.getBytes().length, content); - os.write(request.getBytes()); - os.flush(); - - String document = read(client); - // Should return item - // assertTrue(document.indexOf("updated item=" + index) != -1); - // Should return code 412 PreconditionFailed. - Assert.assertTrue(document.indexOf("HTTP/1.1 412") != -1); - } - - /** - * Read response stream from the given socket. - * @param socket - * @return - * @throws IOException - */ - private static String read(Socket socket) throws IOException { - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(socket - .getInputStream())); - StringBuffer sb = new StringBuffer(); - String str; - while ((str = reader.readLine()) != null) { - sb.append(str); - } - return sb.toString(); - } finally { - if (reader != null) { - reader.close(); - } - } - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTBindingTestCase.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTBindingTestCase.java deleted file mode 100644 index e08069f479..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTBindingTestCase.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ -package org.apache.tuscany.sca.binding.rest; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.Socket; -import java.text.MessageFormat; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -/** - * HTTP binding unit tests. - * - * @version $Rev$ $Date$ - */ -public class RESTBindingTestCase { - - private static final String REQUEST1_HEADER = - "GET /httpservice/test HTTP/1.0\n" + "Host: localhost\n" - + "Content-Type: text/xml\n" - + "Connection: close\n" - + "Content-Length: "; - private static final String REQUEST1_CONTENT = ""; - private static final String REQUEST1 = - REQUEST1_HEADER + REQUEST1_CONTENT.getBytes().length + "\n\n" + REQUEST1_CONTENT; - - private static final String REQUEST2_HEADER = - "GET /webcontent/test.html HTTP/1.0\n" + "Host: localhost\n" - + "Content-Type: text/xml\n" - + "Connection: close\n" - + "Content-Length: "; - private static final String REQUEST2_CONTENT = ""; - private static final String REQUEST2 = - REQUEST2_HEADER + REQUEST2_CONTENT.getBytes().length + "\n\n" + REQUEST2_CONTENT; - - private static final String REQUEST3_HEADER = - "GET /httpget/{0} HTTP/1.0\n" + "Host: localhost\n" - + "Content-Type: text/xml\n" - + "Connection: close\n" - + "Content-Length: "; - private static final String REQUEST3_CONTENT = ""; - private static final String REQUEST3 = - REQUEST3_HEADER + REQUEST3_CONTENT.getBytes().length + "\n\n" + REQUEST3_CONTENT; - - private static final int HTTP_PORT = 8085; - - private static Node node; - - @BeforeClass - public static void setUp() throws Exception { - try { - String contribution = ContributionLocationHelper.getContributionLocation(RESTBindingCacheTestCase.class); - node = NodeFactory.newInstance().createNode("test.composite", new Contribution("test", contribution)); - node.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @AfterClass - public static void tearDown() throws Exception { - node.stop(); - } - - /** - * Test invoking a POJO service implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testServiceImplementation() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - - String document = read(client); - Assert.assertTrue(document.indexOf("

hey") != -1); - } - - /** - * Test invoking a POJO get method implementation using the HTTP binding. - * @throws Exception - */ - @Test - public void testGetImplementation() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - int index = 0; - String request = MessageFormat.format( REQUEST3, index ); - os.write( request.getBytes()); - os.flush(); - - String document = read(client); - Assert.assertTrue(document.indexOf("

item=" + index) != -1); - } - - /** - * Test getting a static resource provided using the HTTP binding. - * @throws Exception - */ - @Ignore("Implementation resource not available") - public void testStaticResourceImplementation() throws Exception { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST2.getBytes()); - os.flush(); - - String document = read(client); - Assert.assertTrue(document.indexOf("

hello") != -1); - } - - /** - * Read response stream from the given socket. - * @param socket - * @return - * @throws IOException - */ - private static String read(Socket socket) throws IOException { - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); - StringBuffer sb = new StringBuffer(); - String str; - while ((str = reader.readLine()) != null) { - sb.append(str); - } - return sb.toString(); - } finally { - if (reader != null) { - reader.close(); - } - } - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestBindingCacheImpl.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestBindingCacheImpl.java deleted file mode 100644 index 5c5e4db8ed..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestBindingCacheImpl.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package org.apache.tuscany.sca.binding.rest; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.Date; - -import org.apache.tuscany.sca.common.http.HTTPCacheContext; - -/** - * Test service implementation that implements a various conditional HTTP - * methods. For testing, the id==0 items are very old (Date(0)), not modified, - * and always match ETags and the id==1 items are always brand new (Date()), - * modified, and never match ETags. Using these ids one can test the - * LastModified and ETag headers of the requests. - * - * @version $Rev$ $Date$ - */ -public class TestBindingCacheImpl { - - /** - * Implements the HTTP get method of the collection implementation. - * @param id - * @return - */ - public InputStream get(String id) { - return new ByteArrayInputStream(("

item=" + id + "").getBytes()); - } - - /** - * Implements the HTTP conditional get method of the collection implementation. - * @param id - * @return - */ - public InputStream conditionalGet(String id, HTTPCacheContext cacheContext) throws NotModifiedException, - PreconditionFailedException { - - if (cacheContext != null) { - if (cacheContext.ifModifiedSince) { - if ((id.equals("1")) && (0 > cacheContext.lastModifiedDate.compareTo(new Date()))) - throw new NotModifiedException("item 1 was modified on " + new Date()); - } - if (cacheContext.ifUnmodifiedSince) { - if ((id.equals("0")) && (0 > cacheContext.lastModifiedDate.compareTo(new Date()))) - throw new PreconditionFailedException("item 0 was modified on " + new Date(0)); - } - if (cacheContext.ifMatch) { - if (id.equals("1")) - throw new PreconditionFailedException("item 1 eTag does not match " + cacheContext.getETag()); - } - if (cacheContext.ifNoneMatch) { - if (id.equals("0")) - throw new PreconditionFailedException("item 0 eTag matches " + cacheContext.getETag()); - } - } - return new ByteArrayInputStream(("

item=" + id + "").getBytes()); - } - - /** - * Implements the HTTP delete method of the collection implementation. - * @param id - * @return - */ - public InputStream delete(String id) { - return new ByteArrayInputStream(("

deleted item=" + id + "").getBytes()); - } - - /** - * Implements the HTTP conditional delete method of the collection implementation. - * @param id - * @return - */ - public InputStream conditionalDelete(String id, HTTPCacheContext cacheContext) throws NotModifiedException, - PreconditionFailedException { - - if (cacheContext != null) { - if (cacheContext.ifModifiedSince) { - if ((id.equals("1")) && (0 > cacheContext.lastModifiedDate.compareTo(new Date()))) - throw new NotModifiedException("item 1 was modified on " + new Date()); - } - if (cacheContext.ifUnmodifiedSince) { - if ((id.equals("0")) && (0 > cacheContext.lastModifiedDate.compareTo(new Date()))) - throw new PreconditionFailedException("item 0 was modified on " + new Date(0)); - } - if (cacheContext.ifMatch) { - if (id.equals("1")) - throw new PreconditionFailedException("item 1 eTag does not match " + cacheContext.getETag()); - } - if (cacheContext.ifNoneMatch) { - if (id.equals("0")) - throw new PreconditionFailedException("item 0 eTag matches " + cacheContext.getETag()); - } - } - return new ByteArrayInputStream(("

deleted item=" + id + "").getBytes()); - } - - /** - * Implements the HTTP post method of the collection implementation. - * @param id - * @return - */ - public InputStream post() { - int id = (new java.util.Random()).nextInt(Integer.MAX_VALUE); - return new ByteArrayInputStream(("

posted item=" + id + "").getBytes()); - } - - /** - * Implements the HTTP conditional post method of the collection implementation. - * @param id - * @return - */ - public HTTPCacheContext conditionalPost(HTTPCacheContext cacheContext) throws NotModifiedException, - PreconditionFailedException { - String id = "" + (new java.util.Random()).nextInt(Integer.MAX_VALUE); - - if (cacheContext != null) { - if (cacheContext.ifModifiedSince) { - if (0 >= cacheContext.lastModifiedDate.compareTo(new Date(0))) - throw new NotModifiedException("item was modified on " + new Date()); - } - if (cacheContext.ifUnmodifiedSince) { - if ((0 >= cacheContext.lastModifiedDate.compareTo(new Date(0)))) - throw new PreconditionFailedException("item was modified on " + new Date(0)); - } - if (cacheContext.ifMatch) { - if (cacheContext.getETag().equalsIgnoreCase("ETagNoneMatch")) - throw new PreconditionFailedException("item eTag does not match " + cacheContext.getETag()); - } - if (cacheContext.ifNoneMatch) { - if (cacheContext.getETag().equalsIgnoreCase("ETagMatch")) - throw new PreconditionFailedException("item eTag matches " + cacheContext.getETag()); - } - } - - // Return the ETag and LastModfied fields by serialize to a byte array - HTTPCacheContext returnContext = new HTTPCacheContext(); - returnContext.setETag("ETag" + (new java.util.Random()).nextInt(Integer.MAX_VALUE)); - returnContext.setLastModified(new Date()); - return returnContext; - } - - /** - * Implements the HTTP update/put method of the collection implementation. - * @param id - * @return - */ - public InputStream put(String id) { - return new ByteArrayInputStream(("

updated item=" + id + "").getBytes()); - } - - /** - * Implements the HTTP conditional update/put method of the collection implementation. - * @param id - * @return - */ - public InputStream conditionalPut(String id, HTTPCacheContext cacheContext) throws NotModifiedException, - PreconditionFailedException { - - if (cacheContext != null) { - if (cacheContext.ifModifiedSince) { - if ((id.equals("1")) && (0 > cacheContext.lastModifiedDate.compareTo(new Date()))) - throw new NotModifiedException("item 1 was modified on " + new Date()); - } - if (cacheContext.ifUnmodifiedSince) { - if ((id.equals("0")) && (0 > cacheContext.lastModifiedDate.compareTo(new Date()))) - throw new PreconditionFailedException("item 0 was modified on " + new Date(0)); - } - if (cacheContext.ifMatch) { - if (id.equals("1")) - throw new PreconditionFailedException("item 1 eTag does not match " + cacheContext.getETag()); - } - if (cacheContext.ifNoneMatch) { - if (id.equals("0")) - throw new PreconditionFailedException("item 0 eTag matches " + cacheContext.getETag()); - } - } - - return new ByteArrayInputStream(("

updated item=" + id + "").getBytes()); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestGetImpl.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestGetImpl.java deleted file mode 100644 index 4cb1bce73f..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestGetImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package org.apache.tuscany.sca.binding.rest; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -/** - * Test service implementation that implements a get method. - * - * @version $Rev$ $Date$ - */ -public class TestGetImpl { - - public InputStream get(String id) { - return new ByteArrayInputStream(("

item=" + id + "").getBytes()); - - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestServiceImpl.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestServiceImpl.java deleted file mode 100644 index 6b21d6094f..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/TestServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package org.apache.tuscany.sca.binding.rest; - -import java.io.IOException; - -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - -import org.oasisopen.sca.annotation.Service; - -/** - * Test service implementation. - * - * @version $Rev$ $Date$ - */ - -@Service(Servlet.class) -public class TestServiceImpl implements Servlet { - - public void init(ServletConfig config) throws ServletException { - } - - public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { - //HttpServletResponse httpResponse = (HttpServletResponse)response; - response.getOutputStream().print("

hey"); - } - - public void destroy() { - } - - public ServletConfig getServletConfig() { - return null; - } - - public String getServletInfo() { - return null; - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/rpc/EchoServiceTestCase.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/rpc/EchoServiceTestCase.java deleted file mode 100644 index a96f8ebb03..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/rpc/EchoServiceTestCase.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package org.apache.tuscany.sca.binding.rest.rpc; - -import java.net.Socket; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.meterware.httpunit.GetMethodWebRequest; -import com.meterware.httpunit.WebConversation; -import com.meterware.httpunit.WebRequest; -import com.meterware.httpunit.WebResponse; - -public class EchoServiceTestCase { - private static final String SERVICE_URL_JSON = "http://localhost:8085/EchoService/json"; - private static final String SERVICE_URL_XML = "http://localhost:8085/EchoService/xml"; - - private static final String XML_RESPONSE = "" + - "" + - "Hello RPC"; - - private static Node node; - - @BeforeClass - public static void init() throws Exception { - try { - String contribution = ContributionLocationHelper.getContributionLocation(EchoServiceTestCase.class); - node = NodeFactory.newInstance().createNode("echo.composite", new Contribution("echo", contribution)); - node.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @AfterClass - public static void destroy() throws Exception { - if(node != null) { - node.stop(); - } - } - - @Test - public void testPing() throws Exception { - new Socket("127.0.0.1", 8085); - // System.in.read(); - } - - @Test - public void testJSONRPCGetOperationWithString() throws Exception { - String queryString = "?method=echo&msg=Hello RPC"; - - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest(SERVICE_URL_JSON + queryString); - request.setHeaderField("Content-Type", "application/json"); - WebResponse response = wc.getResource(request); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertEquals("Hello RPC", response.getText()); - } - - @Test - public void testJSONRPCGetOperationWithInt() throws Exception { - String queryString = "?method=echoInt¶m=1000"; - - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest(SERVICE_URL_JSON + queryString); - request.setHeaderField("Content-Type", "application/json"); - WebResponse response = wc.getResource(request); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertEquals("1000", response.getText()); - } - - @Test - public void testRPCGetArrayOperationWithString() throws Exception { - String queryString = "?method=echoArrayString&msgArray=Hello RPC1&msgArray=Hello RPC2"; - - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest(SERVICE_URL_JSON + queryString); - request.setHeaderField("Content-Type", "application/json"); - WebResponse response = wc.getResource(request); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertEquals("[\"Hello RPC1\",\"Hello RPC2\"]", response.getText()); - } - - @Test - public void testRPCGetArrayOperationWithInt() throws Exception { - String queryString = "?method=echoArrayInt&intArray=1000&intArray=2000"; - - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest(SERVICE_URL_JSON + queryString); - request.setHeaderField("Content-Type", "application/json"); - WebResponse response = wc.getResource(request); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertEquals("[1000,2000]", response.getText()); - } - - - @Test - public void testXMLRPCGetOperation() throws Exception { - String queryString = "?method=echo&msg=Hello RPC"; - - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest(SERVICE_URL_XML + queryString); - request.setHeaderField("Content-Type", "application/xml"); - WebResponse response = wc.getResource(request); - - //System.out.println("Expected>>" + XML_RESPONSE); - //System.out.println("Received>>" + response.getText()); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertEquals(XML_RESPONSE, response.getText()); - } - - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/binary/BinaryServiceTestCase.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/binary/BinaryServiceTestCase.java deleted file mode 100644 index 2ca662ec4e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/binary/BinaryServiceTestCase.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package org.apache.tuscany.sca.binding.rest.wireformat.binary; - -import java.io.ByteArrayInputStream; -import java.net.Socket; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.meterware.httpunit.GetMethodWebRequest; -import com.meterware.httpunit.PostMethodWebRequest; -import com.meterware.httpunit.PutMethodWebRequest; -import com.meterware.httpunit.WebConversation; -import com.meterware.httpunit.WebRequest; -import com.meterware.httpunit.WebResponse; - -public class BinaryServiceTestCase { - private static final String SERVICE_URL = "http://localhost:8085/Binary"; - - private static final String CONTENT = "ABCDefgh"; - private static final String UPDATED_CONTENT = "abcdEFGH"; - - private static Node node; - - @BeforeClass - public static void init() throws Exception { - try { - String contribution = ContributionLocationHelper.getContributionLocation(BinaryServiceTestCase.class); - node = NodeFactory.newInstance().createNode("binary.composite", new Contribution("binary", contribution)); - node.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @AfterClass - public static void destroy() throws Exception { - if (node != null) { - node.stop(); - } - } - - @Test - public void testPing() throws Exception { - new Socket("127.0.0.1", 8085); - //System.in.read(); - } - - @Test - public void testMethods() throws Exception { - WebConversation wc = new WebConversation(); - - // Create content - WebRequest request = - new PostMethodWebRequest(SERVICE_URL, new ByteArrayInputStream(CONTENT.getBytes("UTF-8")), - "application/octet-stream"); - WebResponse response = wc.getResource(request); - - Assert.assertEquals(204, response.getResponseCode()); - - // Read the content - request = new GetMethodWebRequest(SERVICE_URL); - response = wc.getResource(request); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertEquals(CONTENT, response.getText()); - - request = - new PutMethodWebRequest(SERVICE_URL, new ByteArrayInputStream(UPDATED_CONTENT.getBytes("UTF-8")), - "application/octet-stream"); - response = wc.getResource(request); - - Assert.assertEquals(204, response.getResponseCode()); - - //read new results and expect to get new item back in the response - request = new GetMethodWebRequest(SERVICE_URL); - response = wc.getResource(request); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertEquals(UPDATED_CONTENT, response.getText()); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java deleted file mode 100644 index 2aa59af508..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package org.apache.tuscany.sca.binding.rest.wireformat.json; - -import java.io.ByteArrayInputStream; -import java.net.Socket; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.meterware.httpunit.GetMethodWebRequest; -import com.meterware.httpunit.PostMethodWebRequest; -import com.meterware.httpunit.WebConversation; -import com.meterware.httpunit.WebRequest; -import com.meterware.httpunit.WebResponse; - -public class CatalogServiceTestCase { - private static final String SERVICE_URL = "http://localhost:8085/Catalog"; - - private static final String GET_RESPONSE = "{\"items\":[{\"price\":\"$1.55\",\"name\":\"Pear\"},{\"price\":\"$2.99\",\"name\":\"Apple\"},{\"price\":\"$3.55\",\"name\":\"Orange\"}]}"; - private static final String NEW_ITEM = "{\"price\":\"$4.35\",\"name\":\"Grape\"}\""; - private static final String GET_NEW_RESPONSE = "{\"items\":[{\"price\":\"$1.55\",\"name\":\"Pear\"},{\"price\":\"$2.99\",\"name\":\"Apple\"},{\"price\":\"$3.55\",\"name\":\"Orange\"},{\"price\":\"$4.35\",\"name\":\"Grape\"}]}"; - private static final String UPDATED_ITEM = "{\"price\":\"$1.35\",\"name\":\"Grape\"}\""; - private static final String GET_UPDATED_RESPONSE = "{\"items\":[{\"price\":\"$1.55\",\"name\":\"Pear\"},{\"price\":\"$2.99\",\"name\":\"Apple\"},{\"price\":\"$3.55\",\"name\":\"Orange\"},{\"price\":\"$1.35\",\"name\":\"Grape\"}]}"; - - private static Node node; - - @BeforeClass - public static void init() throws Exception { - try { - String contribution = ContributionLocationHelper.getContributionLocation(CatalogServiceTestCase.class); - node = NodeFactory.newInstance().createNode("store.composite", new Contribution("catalog", contribution)); - node.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @AfterClass - public static void destroy() throws Exception { - if(node != null) { - node.stop(); - } - } - - @Test - public void testPing() throws Exception { - new Socket("127.0.0.1", 8085); - //System.in.read(); - } - - @Test - public void testGetInvocation() throws Exception { - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest(SERVICE_URL); - request.setHeaderField("Content-Type", "application/json"); - WebResponse response = wc.getResource(request); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertNotNull(response.getText()); - Assert.assertTrue(validateJsonResponse(GET_RESPONSE,response.getText())); - } - - - @Test - public void testPostInvocation() throws Exception { - //Add new item to catalog - WebConversation wc = new WebConversation(); - WebRequest request = new PostMethodWebRequest(SERVICE_URL, new ByteArrayInputStream(NEW_ITEM.getBytes("UTF-8")),"application/json"); - request.setHeaderField("Content-Type", "application/json"); - WebResponse response = wc.getResource(request); - - 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/json"); - response = wc.getResource(request); - - //for debug purposes - //System.out.println(">>>" + GET_UPDATED_RESPONSE); - //System.out.println(">>>" + response.getText()); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertNotNull(response.getText()); - Assert.assertTrue(validateJsonResponse(GET_NEW_RESPONSE,response.getText())); - } - - @Test - 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/json"); - request.setHeaderField("Content-Type", "application/json"); - WebResponse response = wc.getResource(request); - - 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/json"); - response = wc.getResource(request); - - //for debug purposes - //System.out.println(">>>" + GET_UPDATED_RESPONSE); - //System.out.println(">>>" + response.getText()); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertNotNull(response.getText()); - Assert.assertTrue(validateJsonResponse(GET_UPDATED_RESPONSE,response.getText())); - } - - - private boolean validateJsonResponse(String expected, String actual) throws JSONException { - JSONObject jsonExpected = new JSONObject(expected); - JSONObject jsonActual = new JSONObject(actual); - - if(jsonExpected.getJSONArray("items").length() != jsonActual.getJSONArray("items").length()) { - return false; - } - - return true; - - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java deleted file mode 100644 index 9e1b99c9bc..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package org.apache.tuscany.sca.binding.rest.wireformat.xml; - -import java.io.ByteArrayInputStream; -import java.net.Socket; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.meterware.httpunit.GetMethodWebRequest; -import com.meterware.httpunit.PostMethodWebRequest; -import com.meterware.httpunit.WebConversation; -import com.meterware.httpunit.WebRequest; -import com.meterware.httpunit.WebResponse; - -public class CustomerServiceTestCase { - private static final String SERVICE_URL = "http://localhost:8085/Customer"; - - private static final String GET_RESPONSE = "john@domain.comJohnJohn"; - private static final String UPDATED_ITEM = "john@updated-domain.comJohnJohn"; - private static final String GET_UPDATED_RESPONSE = "john@updated-domain.comJohnJohn"; - - private static Node node; - - @BeforeClass - public static void init() throws Exception { - try { - String contribution = ContributionLocationHelper.getContributionLocation(CustomerServiceTestCase.class); - node = NodeFactory.newInstance().createNode("customer.composite", new Contribution("customer", contribution)); - node.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @AfterClass - public static void destroy() throws Exception { - if(node != null) { - node.stop(); - } - } - - @Test - public void testPing() throws Exception { - new Socket("127.0.0.1", 8085); - //System.in.read(); - } - - @Test - public void testGetInvocation() throws Exception { - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest(SERVICE_URL+"/John"); - request.setHeaderField("Content-Type", "application/xml"); - WebResponse response = wc.getResource(request); - - //for debug purposes - 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 testGetInvocationNotFound() throws Exception { - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest(SERVICE_URL+"/Foo"); - request.setHeaderField("Content-Type", "application/xml"); - WebResponse response = wc.getResource(request); - - Assert.assertEquals(404, response.getResponseCode()); - } - - @Test - 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"); - WebResponse response = wc.getResource(request); - - 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()); - - Assert.assertEquals(200, response.getResponseCode()); - Assert.assertEquals(GET_UPDATED_RESPONSE, response.getText()); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/binary/BinaryService.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/binary/BinaryService.java deleted file mode 100644 index 4749383a0c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/binary/BinaryService.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.binary; - -import java.io.IOException; -import java.io.InputStream; - -import javax.activation.DataSource; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * - */ -@Remotable -public interface BinaryService { - @GET - InputStream get(); - - @PUT - void update(InputStream is) throws IOException; - - @POST - void create(DataSource dataSource) throws IOException; -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/binary/BinaryServiceImpl.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/binary/BinaryServiceImpl.java deleted file mode 100644 index aefbf64504..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/binary/BinaryServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.binary; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.activation.DataSource; - -import org.oasisopen.sca.annotation.Scope; - -/** - * - */ -@Scope("COMPOSITE") -public class BinaryServiceImpl implements BinaryService { - private byte[] content; - private int length; - - public void create(DataSource dataSource) throws IOException { - content = new byte[10240]; - InputStream is = dataSource.getInputStream(); - length = is.read(content); - System.out.println("Content received: " + length); - } - - public InputStream get() { - byte[] bytes = new byte[length]; - System.arraycopy(content, 0, bytes, 0, length); - System.out.println("Content sent: " + length); - return new ByteArrayInputStream(bytes); - } - - public void update(InputStream is) throws IOException { - length = is.read(content); - System.out.println("Content updated: " + length); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/Customer.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/Customer.java deleted file mode 100644 index 08506ebd48..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/Customer.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.customer; - - -/** - * Customer data - */ -public class Customer { - private String id; - private String email; - private String name; - - public Customer() { - super(); - } - - public Customer(String id, String name, String email) { - super(); - this.id = id; - this.email = email; - this.name = name; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String toString() { - return "id: " + id + " name: " + name + " e-mail: " + email; - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/CustomerService.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/CustomerService.java deleted file mode 100644 index 403804e95e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/CustomerService.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.customer; - -import javax.jws.WebResult; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.Response; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface CustomerService { - - @GET - @WebResult(name = "Customer", targetNamespace = "") - @Path("{name}") - Customer get(@PathParam("name") String name); - - @GET - @WebResult(name = "Customer", targetNamespace = "") - Response getResponse(); - - @POST - Response addCustomer(Customer customer); - - @PUT - void updateCustomer(Customer customer); -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/CustomerServiceImpl.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/CustomerServiceImpl.java deleted file mode 100644 index d0f2809cd6..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/customer/CustomerServiceImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.customer; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Scope; - -@Scope("COMPOSITE") -public class CustomerServiceImpl implements CustomerService { - private Map customers = new HashMap(); - - @Init - public void init() { - customers.put("John", new Customer("John", "John", "john@domain.com")); - } - - public Customer get(String name) { - Customer c = customers.get(name); - if (c == null) { - // Not found - throw new WebApplicationException(Status.NOT_FOUND); - } - return c; - } - - public Response getResponse() { - return Response.ok(get("John")).build(); - } - - public Response addCustomer(Customer customer) { - customers.put(customer.getName(), customer); - return Response.created(URI.create("/001")).build(); - } - - public void updateCustomer(Customer customer) { - if (customers.get(customer.getName()) != null) { - customers.put(customer.getName(), customer); - } - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/echo/Echo.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/echo/Echo.java deleted file mode 100644 index b93ff0838b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/echo/Echo.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ -package services.echo; - -import javax.ws.rs.QueryParam; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * Interface of our sample JSONRPC service. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface Echo { - - String echo(@QueryParam("msg") String msg); - - int echoInt(@QueryParam("param") int param); - - String [] echoArrayString(@QueryParam("msgArray") String[] stringArray); - - int [] echoArrayInt(@QueryParam("intArray") int[] intArray); - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/echo/EchoImpl.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/echo/EchoImpl.java deleted file mode 100644 index 6bc22bd41a..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/echo/EchoImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ -package services.echo; - - -/** - * A simple client component that uses a reference with an JSONRPC binding. - * - * @version $Rev$ $Date$ - */ -public class EchoImpl implements Echo { - - public String echo(String msg) { - return msg; - } - - public int echoInt(int param) { - int value = param; - return value; - } - - public String[] echoArrayString(String[] stringArray) { - return stringArray; - } - - public int[] echoArrayInt(int[] intArray) { - return intArray; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java deleted file mode 100644 index 7e579c6aba..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.store; - -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; - -import org.oasisopen.sca.annotation.Remotable; - - -@Remotable -public interface Catalog { - - @GET - Items getItem(); - - @GET - @Path("{id}") - Item getItemById(@PathParam("id") String itemId); - - @POST - void addItem(Item item); - - @PUT - void updateItem(Item item); - - @DELETE - @Path("{id}") - void deleteItem(@PathParam("id") String itemId); -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverter.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverter.java deleted file mode 100644 index 45f8949633..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverter.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.store; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface CurrencyConverter { - public double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount); - - public String getCurrencySymbol(String currencyCode); -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverterImpl.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverterImpl.java deleted file mode 100644 index 9956e207e1..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverterImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.store; - -public class CurrencyConverterImpl implements CurrencyConverter { - public double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) { - if (toCurrencyCode.equals("USD")) - return amount; - else if (toCurrencyCode.equals("EUR")) - return ((double)Math.round(amount * 0.7256 * 100)) /100; - return 0; - } - - public String getCurrencySymbol(String currencyCode) { - if (currencyCode.equals("USD")) - return "$"; - else if (currencyCode.equals("EUR")) - return "E"; //"€"; - return "?"; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/FruitsCatalogImpl.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/FruitsCatalogImpl.java deleted file mode 100644 index afe3d3863e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/FruitsCatalogImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.store; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -@Scope("COMPOSITE") -public class FruitsCatalogImpl implements Catalog { - - @Property - public String currencyCode = "USD"; - - @Reference - public CurrencyConverter currencyConverter; - - private Map catalog = new HashMap(); - - @Init - public void init() { - String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); - catalog.put("Apple", new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99))); - catalog.put("Orange", new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55))); - catalog.put("Pear", new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55))); - } - - public Items getItem() { - Items items = new Items(); - items.setItems(new ArrayList(catalog.values())); - return items; - } - - public Item getItemById(String itemId) { - return catalog.get(itemId); - } - - public void addItem(Item item) { - catalog.put(item.getName(),item); - } - - public void updateItem(Item item) { - if(catalog.get(item.getName()) != null) { - catalog.put(item.getName(), item); - } - } - - public void deleteItem(String itemId) { - if(catalog.get(itemId) != null) { - catalog.remove(itemId); - } - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Item.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Item.java deleted file mode 100644 index d5a298eee5..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Item.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.store; - -public class Item { - private String name; - private String price; - - public Item() { - } - - public Item(String name, String price) { - this.name = name; - this.price = price; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPrice() { - return price; - } - - public void setPrice(String price) { - this.price = price; - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Items.java b/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Items.java deleted file mode 100644 index 82a995943d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/binding-rest-runtime/src/test/java/services/store/Items.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -package services.store; - -import java.util.List; - -/** - * - */ -public class Items { - private List items; - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } -} -- cgit v1.2.3