You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by el...@apache.org on 2009/07/02 14:34:02 UTC
svn commit: r790563 [1/2] - in /incubator/wink/trunk:
wink-component-test-support/src/main/java/org/apache/wink/server/internal/servlet/
wink-component-test-support/src/main/java/org/apache/wink/test/mock/
wink-examples/apps/HelloWorld/src/test/java/or...
Author: elman
Date: Thu Jul 2 12:34:01 2009
New Revision: 790563
URL: http://svn.apache.org/viewvc?rev=790563&view=rev
Log:
JUnit tests refactoring:
1. Throw ServletException from invoke method.
2. Simplify SpringMockServletInvocationTest
Added:
incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/TestUtils.java
Modified:
incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/server/internal/servlet/MockServletInvocationTest.java
incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringAwareTestCase.java
incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringMockServletInvocationTest.java
incubator/wink/trunk/wink-examples/apps/HelloWorld/src/test/java/org/apache/wink/example/helloworld/HelloWorldTest.java
incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/LockingTest.java
incubator/wink/trunk/wink-examples/ext/History/src/test/java/org/apache/wink/example/history/HistoryTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceBeanTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithDuplicateWorkspaceTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithEmptyPathTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/DispatchErrorTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/JAXRSContextTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/QueryTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriConfigurationTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriDetectionTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/CustomLocationHeaderConfigurationTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DefaultLocationHeaderConfigurationTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DispatchIPv6Test.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/HeadTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/NoContentTypePostTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/ParameterConversionTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/PreconditionsTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/SlashEndingUriTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/StreamResponseTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/UnknownMimeTypeTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/HttpHeadersImplTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/UriInfoImplTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/EntityLocatorProviderTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/JAXBElementProviderTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/FindResourceMethodTest2.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/InjectableDataTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/PrototypeResourceTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/ResponseDispatchTest.java
incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/ValueConvertorTest.java
incubator/wink/trunk/wink-spring-support/src/test/java/org/apache/wink/spring/PropertiesOverrideTest.java
incubator/wink/trunk/wink-spring-support/src/test/java/org/apache/wink/spring/RegistrarTest.java
Modified: incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/server/internal/servlet/MockServletInvocationTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/server/internal/servlet/MockServletInvocationTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/server/internal/servlet/MockServletInvocationTest.java (original)
+++ incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/server/internal/servlet/MockServletInvocationTest.java Thu Jul 2 12:34:01 2009
@@ -125,17 +125,13 @@
* the filled request
* @return a new response as filled by the servlet
* @throws IOException
- * io error
* @throws ServletException
*/
- public MockHttpServletResponse invoke(MockHttpServletRequest request) throws IOException {
+ public MockHttpServletResponse invoke(MockHttpServletRequest request) throws ServletException,
+ IOException {
MockHttpServletResponse response = new MockHttpServletResponse();
- try {
- servlet.service(request, response);
- } catch (ServletException e) {
- throw new RuntimeException(e);
- }
+ servlet.service(request, response);
return response;
}
Modified: incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringAwareTestCase.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringAwareTestCase.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringAwareTestCase.java (original)
+++ incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringAwareTestCase.java Thu Jul 2 12:34:01 2009
@@ -95,11 +95,7 @@
}
protected String getPackagePath() {
- return packageToPath(getClass().getPackage().getName());
- }
-
- public static String packageToPath(String packageName) {
- return packageName.replace(".", File.separator);
+ return TestUtils.packageToPath(getClass().getPackage().getName());
}
}
Modified: incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringMockServletInvocationTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringMockServletInvocationTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringMockServletInvocationTest.java (original)
+++ incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/SpringMockServletInvocationTest.java Thu Jul 2 12:34:01 2009
@@ -17,34 +17,17 @@
* under the License.
*
*******************************************************************************/
-
+
package org.apache.wink.test.mock;
-import java.io.ByteArrayInputStream;
-import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import org.apache.wink.test.diff.DiffIgnoreUpdateWithAttributeQualifier;
-import org.custommonkey.xmlunit.Diff;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-import org.w3c.dom.Document;
-
+import org.springframework.mock.web.MockServletConfig;
/**
* Base class for tests using mock servlet invocation (= invoking directly
@@ -52,128 +35,14 @@
*/
public abstract class SpringMockServletInvocationTest extends SpringAwareTestCase {
- private Object requestProcessor;
- private Method methodHandleRequest;
- private Class<?> requestProcessorClass;
+ private HttpServlet servlet;
protected void setUp() throws Exception {
super.setUp();
- requestProcessorClass = Class.forName("org.apache.wink.server.internal.RequestProcessor");
- Method getRequestProcessorMethod = requestProcessorClass.getMethod("getRequestProcessor",
- ServletContext.class, String.class);
- requestProcessor = getRequestProcessorMethod.invoke(null, servletContext, (String) null);
- methodHandleRequest = requestProcessorClass.getMethod("handleRequest",
- HttpServletRequest.class, HttpServletResponse.class);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getRequestProcessor(Class<T> cls) {
- return (T) requestProcessor;
- }
-
- public static DocumentBuilder createDocumentBuilder() throws ParserConfigurationException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- return factory.newDocumentBuilder();
- }
-
- @SuppressWarnings("unchecked")
- protected <T> T getResourceRegistry(Class<T> cls) {
- try {
- Method getConfigurationMethod = requestProcessor.getClass().getMethod(
- "getConfiguration");
- Object configuration = getConfigurationMethod.invoke(requestProcessor);
- Method getUrletRegistryMethod = configuration.getClass().getMethod(
- "getResourceRegistry");
- return (T) getUrletRegistryMethod.invoke(configuration);
- } catch (SecurityException e) {
- throw new RuntimeException(e);
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * appends package to the name and returns it as stream.
- *
- * @param name
- * @param cls
- * TODO
- * @return
- */
- public static InputStream getResourceOfSamePackage(String name, Class<?> cls) {
- String packagePath = packageToPath(cls.getPackage().getName());
- return SpringMockServletInvocationTest.class.getClassLoader().getResourceAsStream(
- packagePath + File.separator + name);
- }
-
- public static byte[] getResourceOfSamePackageAsBytes(String name, Class<?> cls)
- throws Exception {
- InputStream resource = getResourceOfSamePackage(name, cls);
- byte[] b = new byte[4096];
- int read = resource.read(b);
- byte[] result = new byte[read];
- System.arraycopy(b, 0, result, 0, read);
- return result;
- }
-
- /**
- * returns xml from file. Xml must be located in the same package as the
- * current class.
- *
- * @param fileName
- * @param cls
- * TODO
- * @return
- * @throws Exception
- */
- protected static Document getXML(String fileName, Class<?> cls) throws Exception {
- return createDocumentBuilder().parse(getResourceOfSamePackage(fileName, cls));
- }
-
- public static Document getXML(byte[] bs) throws Exception {
- return createDocumentBuilder().parse(new ByteArrayInputStream(bs));
- }
-
- public static String diffIgnoreUpdateWithAttributeQualifier(String expectedFileName,
- byte[] actual, Class<?> cls) throws Exception {
- Document xmlExpected = getXML(expectedFileName, cls);
- Document xmlActual = getXML(actual);
- Diff diff = new DiffIgnoreUpdateWithAttributeQualifier(xmlExpected, xmlActual);
- if (diff.similar()) {
- return null;
- }
- System.err.println("Expected:\r\n" + printPrettyXML(xmlExpected));
- System.err.println("Actual:\r\n" + printPrettyXML(xmlActual));
- return diff.toString();
- }
-
- protected String diffIgnoreUpdateWithAttributeQualifier(byte[] expected, byte[] actual)
- throws Exception {
- Document xmlExpected = getXML(expected);
- Document xmlActual = getXML(actual);
- Diff diff = new DiffIgnoreUpdateWithAttributeQualifier(xmlExpected, xmlActual);
- if (diff.similar()) {
- return null;
- }
- System.err.println("Expected:\r\n" + printPrettyXML(xmlExpected));
- System.err.println("Actual:\r\n" + printPrettyXML(xmlActual));
- return diff.toString();
- }
-
- public static String printPrettyXML(Document doc) throws Exception {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty("indent", "yes");
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");
- StringWriter output = new StringWriter();
- transformer.transform(new DOMSource(doc), new StreamResult(output));
- return output.toString();
+
+ servlet = (HttpServlet) Class.forName("org.apache.wink.server.internal.servlet.RestServlet").newInstance();
+ MockServletConfig servletConfig = new MockServletConfig(servletContext);
+ servlet.init(servletConfig);
}
/**
@@ -185,17 +54,12 @@
* @throws IOException
* io error
*/
- public MockHttpServletResponse invoke(MockHttpServletRequest request) throws IOException {
+ public MockHttpServletResponse invoke(MockHttpServletRequest request) throws ServletException,
+ IOException {
MockHttpServletResponse response = new MockHttpServletResponse();
- try {
- methodHandleRequest.invoke(requestProcessor, request, response);
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
+
+ servlet.service(request, response);
+
return response;
}
Added: incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/TestUtils.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/TestUtils.java?rev=790563&view=auto
==============================================================================
--- incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/TestUtils.java (added)
+++ incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/test/mock/TestUtils.java Thu Jul 2 12:34:01 2009
@@ -0,0 +1,97 @@
+package org.apache.wink.test.mock;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.wink.test.diff.DiffIgnoreUpdateWithAttributeQualifier;
+import org.custommonkey.xmlunit.Diff;
+import org.w3c.dom.Document;
+
+
+public class TestUtils {
+
+ public static String packageToPath(String packageName) {
+ return packageName.replace(".", File.separator);
+ }
+
+ public static DocumentBuilder createDocumentBuilder() throws ParserConfigurationException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ return factory.newDocumentBuilder();
+ }
+
+ /**
+ * appends package to the name and returns it as stream.
+ *
+ * @param name
+ * @param cls
+ * TODO
+ * @return
+ */
+ public static InputStream getResourceOfSamePackage(String name, Class<?> cls) {
+ String packagePath = packageToPath(cls.getPackage().getName());
+ return SpringMockServletInvocationTest.class.getClassLoader().getResourceAsStream(
+ packagePath + File.separator + name);
+ }
+
+ public static byte[] getResourceOfSamePackageAsBytes(String name, Class<?> cls)
+ throws Exception {
+ InputStream resource = getResourceOfSamePackage(name, cls);
+ byte[] b = new byte[4096];
+ int read = resource.read(b);
+ byte[] result = new byte[read];
+ System.arraycopy(b, 0, result, 0, read);
+ return result;
+ }
+
+ /**
+ * returns xml from file. Xml must be located in the same package as the
+ * current class.
+ *
+ * @param fileName
+ * @param cls
+ * TODO
+ * @return
+ * @throws Exception
+ */
+ protected static Document getXML(String fileName, Class<?> cls) throws Exception {
+ return createDocumentBuilder().parse(getResourceOfSamePackage(fileName, cls));
+ }
+
+ public static Document getXML(byte[] bs) throws Exception {
+ return createDocumentBuilder().parse(new ByteArrayInputStream(bs));
+ }
+
+ public static String diffIgnoreUpdateWithAttributeQualifier(String expectedFileName,
+ byte[] actual, Class<?> cls) throws Exception {
+ Document xmlExpected = getXML(expectedFileName, cls);
+ Document xmlActual = getXML(actual);
+ Diff diff = new DiffIgnoreUpdateWithAttributeQualifier(xmlExpected, xmlActual);
+ if (diff.similar()) {
+ return null;
+ }
+ System.err.println("Expected:\r\n" + TestUtils.printPrettyXML(xmlExpected));
+ System.err.println("Actual:\r\n" + TestUtils.printPrettyXML(xmlActual));
+ return diff.toString();
+ }
+
+ public static String printPrettyXML(Document doc) throws Exception {
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty("indent", "yes");
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");
+ StringWriter output = new StringWriter();
+ transformer.transform(new DOMSource(doc), new StreamResult(output));
+ return output.toString();
+ }
+
+}
Modified: incubator/wink/trunk/wink-examples/apps/HelloWorld/src/test/java/org/apache/wink/example/helloworld/HelloWorldTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/apps/HelloWorld/src/test/java/org/apache/wink/example/helloworld/HelloWorldTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/apps/HelloWorld/src/test/java/org/apache/wink/example/helloworld/HelloWorldTest.java (original)
+++ incubator/wink/trunk/wink-examples/apps/HelloWorld/src/test/java/org/apache/wink/example/helloworld/HelloWorldTest.java Thu Jul 2 12:34:01 2009
@@ -21,7 +21,6 @@
package org.apache.wink.example.helloworld;
import java.io.FileNotFoundException;
-import java.io.IOException;
import java.io.StringReader;
import java.util.Set;
@@ -29,7 +28,6 @@
import org.apache.wink.common.internal.application.ApplicationFileLoader;
import org.apache.wink.common.internal.utils.MediaTypeUtils;
import org.apache.wink.common.model.atom.AtomEntry;
-import org.apache.wink.example.helloworld.HelloWorld;
import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -51,7 +49,7 @@
}
}
- public void testHelloWorld() throws IOException {
+ public void testHelloWorld() throws Exception {
// prepare a mock request and an empty mock response
MockHttpServletRequest request = constructMockRequest("GET", "/world",
MediaTypeUtils.ATOM_ENTRY);
Modified: incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/LockingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/LockingTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/LockingTest.java (original)
+++ incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/LockingTest.java Thu Jul 2 12:34:01 2009
@@ -26,7 +26,7 @@
import org.apache.wink.example.locking.resources.DefectResource;
import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
import org.apache.wink.test.mock.MockRequestConstructor;
-import org.apache.wink.test.mock.SpringMockServletInvocationTest;
+import org.apache.wink.test.mock.TestUtils;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -47,7 +47,7 @@
MockHttpServletResponse response = invoke(request);
assertEquals("status", 200, response.getStatus());
byte[] defect11 = response.getContentAsString().getBytes();
- String diff = SpringMockServletInvocationTest.diffIgnoreUpdateWithAttributeQualifier(
+ String diff = TestUtils.diffIgnoreUpdateWithAttributeQualifier(
"/results/defect_11.xml", defect11, getClass());
assertNull(diff, diff);
String etag = (String) response.getHeader(HttpHeaders.ETAG);
Modified: incubator/wink/trunk/wink-examples/ext/History/src/test/java/org/apache/wink/example/history/HistoryTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/ext/History/src/test/java/org/apache/wink/example/history/HistoryTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/ext/History/src/test/java/org/apache/wink/example/history/HistoryTest.java (original)
+++ incubator/wink/trunk/wink-examples/ext/History/src/test/java/org/apache/wink/example/history/HistoryTest.java Thu Jul 2 12:34:01 2009
@@ -38,7 +38,7 @@
import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
import org.apache.wink.test.diff.DiffIgnoreUpdateWithAttributeQualifier;
import org.apache.wink.test.mock.MockRequestConstructor;
-import org.apache.wink.test.mock.SpringMockServletInvocationTest;
+import org.apache.wink.test.mock.TestUtils;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.w3c.dom.Document;
@@ -55,7 +55,7 @@
@Override
protected String getPropertiesFile() {
- return SpringMockServletInvocationTest.packageToPath(getClass().getPackage().getName())
+ return TestUtils.packageToPath(getClass().getPackage().getName())
+ "\\history.properties";
}
@@ -74,7 +74,7 @@
MediaType.APPLICATION_ATOM_XML_TYPE);
response = invoke(request);
assertEquals("status", 200, response.getStatus());
- diff = SpringMockServletInvocationTest.diffIgnoreUpdateWithAttributeQualifier(
+ diff = TestUtils.diffIgnoreUpdateWithAttributeQualifier(
"initial_defect1_atom.xml", response.getContentAsString().getBytes(), getClass());
assertNull(diff);
@@ -83,7 +83,7 @@
MediaType.APPLICATION_ATOM_XML_TYPE);
response = invoke(request);
assertEquals("status", 200, response.getStatus());
- diff = SpringMockServletInvocationTest.diffIgnoreUpdateWithAttributeQualifier(
+ diff = TestUtils.diffIgnoreUpdateWithAttributeQualifier(
"defect1_1_atom.xml", response.getContentAsString().getBytes(), getClass());
assertNull(diff);
@@ -106,7 +106,7 @@
MediaType.APPLICATION_ATOM_XML_TYPE);
response = invoke(request);
assertEquals("status", 200, response.getStatus());
- diff = SpringMockServletInvocationTest.diffIgnoreUpdateWithAttributeQualifier(
+ diff = TestUtils.diffIgnoreUpdateWithAttributeQualifier(
"initial_defect1_atom.xml", response.getContentAsString().getBytes(), getClass());
assertNull(diff);
@@ -119,7 +119,7 @@
// try to update the defect, should return 404
request = MockRequestConstructor.constructMockRequest("PUT", "/defects/1",
MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_ATOM_XML,
- SpringMockServletInvocationTest.getResourceOfSamePackageAsBytes("defect1_1_atom.xml",
+ TestUtils.getResourceOfSamePackageAsBytes("defect1_1_atom.xml",
getClass()));
response = invoke(request);
assertEquals("status", 404, response.getStatus());
@@ -130,7 +130,7 @@
MediaType.APPLICATION_ATOM_XML_TYPE);
response = invoke(request);
assertEquals("status", 200, response.getStatus());
- diff = SpringMockServletInvocationTest.diffIgnoreUpdateWithAttributeQualifier(
+ diff = TestUtils.diffIgnoreUpdateWithAttributeQualifier(
"defect1_1_afterdelete_atom.xml", response.getContentAsString().getBytes(), getClass());
assertNull(diff);
@@ -147,11 +147,11 @@
// should return created
request = MockRequestConstructor.constructMockRequest("POST", "/defects",
MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_ATOM_XML,
- SpringMockServletInvocationTest.getResourceOfSamePackageAsBytes("defect1_1_atom.xml",
+ TestUtils.getResourceOfSamePackageAsBytes("defect1_1_atom.xml",
getClass()));
response = invoke(request);
assertEquals("status", 201, response.getStatus());
- diff = SpringMockServletInvocationTest.diffIgnoreUpdateWithAttributeQualifier(
+ diff = TestUtils.diffIgnoreUpdateWithAttributeQualifier(
"defect1_4_atom.xml", response.getContentAsString().getBytes(), getClass());
assertNull(diff);
@@ -159,7 +159,7 @@
// should fail, since the defect was already undeleted
request = MockRequestConstructor.constructMockRequest("POST", "/defects",
MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_ATOM_XML,
- SpringMockServletInvocationTest.getResourceOfSamePackageAsBytes("defect1_1_atom.xml",
+ TestUtils.getResourceOfSamePackageAsBytes("defect1_1_atom.xml",
getClass()));
response = invoke(request);
assertEquals("status", 409, response.getStatus());
@@ -167,11 +167,11 @@
// update undeleted defect
request = MockRequestConstructor.constructMockRequest("PUT", "/defects/1",
MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_ATOM_XML,
- SpringMockServletInvocationTest.getResourceOfSamePackageAsBytes("defect1_1_atom.xml",
+ TestUtils.getResourceOfSamePackageAsBytes("defect1_1_atom.xml",
getClass()));
response = invoke(request);
assertEquals("status", 200, response.getStatus());
- diff = SpringMockServletInvocationTest.diffIgnoreUpdateWithAttributeQualifier(
+ diff = TestUtils.diffIgnoreUpdateWithAttributeQualifier(
"defect1_5_atom.xml", response.getContentAsString().getBytes(), getClass());
assertNull(diff);
@@ -185,7 +185,7 @@
}
private String diffFeed(String expectedFileName, String actual) throws Exception {
- InputStream expected = SpringMockServletInvocationTest.getResourceOfSamePackage(
+ InputStream expected = TestUtils.getResourceOfSamePackage(
expectedFileName, getClass());
// sort feeds
@@ -199,8 +199,8 @@
AtomFeed.marshal(expectedFeed, expectedWriter);
AtomFeed.marshal(actualFeed, actualWriter);
- Document expectedXml = SpringMockServletInvocationTest.getXML(expectedWriter.getBuffer().toString().getBytes());
- Document actualXml = SpringMockServletInvocationTest.getXML(actualWriter.getBuffer().toString().getBytes());
+ Document expectedXml = TestUtils.getXML(expectedWriter.getBuffer().toString().getBytes());
+ Document actualXml = TestUtils.getXML(actualWriter.getBuffer().toString().getBytes());
DiffIgnoreUpdateWithAttributeQualifier diff = new DiffIgnoreUpdateWithAttributeQualifier(
expectedXml, actualXml);
@@ -208,9 +208,9 @@
return null;
}
System.err.println("Expected:\r\n"
- + SpringMockServletInvocationTest.printPrettyXML(expectedXml));
+ + TestUtils.printPrettyXML(expectedXml));
System.err.println("Actual:\r\n"
- + SpringMockServletInvocationTest.printPrettyXML(actualXml));
+ + TestUtils.printPrettyXML(actualXml));
return diff.toString();
}
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceBeanTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceBeanTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceBeanTest.java Thu Jul 2 12:34:01 2009
@@ -20,7 +20,6 @@
package org.apache.wink.server;
-import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
@@ -38,7 +37,6 @@
import org.custommonkey.xmlunit.Diff;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-import org.xml.sax.SAXException;
public class AbstractResourceBeanTest extends MockServletInvocationTest {
@@ -183,7 +181,7 @@
}
}
- public void testServicesCollection() throws IOException {
+ public void testServicesCollection() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/services", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
@@ -191,7 +189,7 @@
assertEquals(EXPECTED_SERVICE_COLLECTION, responseContent);
}
- public void testServicesCollectionWithWorkspaceAndTitle() throws IOException, SAXException {
+ public void testServicesCollectionWithWorkspaceAndTitle() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/services/workspaceAndTitle", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
@@ -207,7 +205,7 @@
diff.identical());
}
- public void testServicesSingleEntry() throws IOException {
+ public void testServicesSingleEntry() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/services/1", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
@@ -215,7 +213,7 @@
assertEquals(EXPECTED_SINGLE_ENTRY + "1", responseContent);
}
- public void testServicesSingleEntryDifferentURIs() throws IOException {
+ public void testServicesSingleEntryDifferentURIs() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/services1/1", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
@@ -229,7 +227,7 @@
// assertEquals(EXPECTED_SINGLE_ENTRY + "1", responseContent);
}
- public void testServicesSingleEntryWithParent() throws IOException {
+ public void testServicesSingleEntryWithParent() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/services/2/parent", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
@@ -237,7 +235,7 @@
assertEquals(EXPECTED_SINGLE_ENTRY_PARENT + "2", responseContent);
}
- public void testServicesSingleEntryWithMultipleParents() throws IOException {
+ public void testServicesSingleEntryWithMultipleParents() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/services/2/parent1", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
@@ -276,7 +274,7 @@
// assertEquals(EXPECTED_SINGLE_ENTRY_PARENT + "2", responseContent);
}
- public void testBeanReferencingAnotherBean() throws IOException {
+ public void testBeanReferencingAnotherBean() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/referenceBean/1", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
@@ -286,7 +284,7 @@
responseContent);
}
- public void testBeanReferencingAnotherResourceWithAnnotations() throws IOException {
+ public void testBeanReferencingAnotherResourceWithAnnotations() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/referenceClass/1", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
@@ -298,7 +296,7 @@
responseContent);
}
- public void testBeanWithParentIsResourceWithAnnotations() throws IOException {
+ public void testBeanWithParentIsResourceWithAnnotations() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/resourceWithAnnotations/2/parent", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithDuplicateWorkspaceTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithDuplicateWorkspaceTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithDuplicateWorkspaceTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithDuplicateWorkspaceTest.java Thu Jul 2 12:34:01 2009
@@ -20,7 +20,6 @@
package org.apache.wink.server;
-import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
@@ -37,7 +36,6 @@
import org.custommonkey.xmlunit.Diff;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-import org.xml.sax.SAXException;
public class AbstractResourceWithDuplicateWorkspaceTest extends MockServletInvocationTest {
@@ -94,7 +92,7 @@
}
}
- public void testBeanWithEmptyPath() throws IOException, SAXException {
+ public void testBeanWithEmptyPath() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/", MediaTypeUtils.ATOM_SERVICE_DOCUMENT_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithEmptyPathTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithEmptyPathTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithEmptyPathTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/AbstractResourceWithEmptyPathTest.java Thu Jul 2 12:34:01 2009
@@ -20,7 +20,6 @@
package org.apache.wink.server;
-import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
@@ -81,7 +80,7 @@
}
}
- public void testBeanWithEmptyPath() throws IOException {
+ public void testBeanWithEmptyPath() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/a", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
@@ -89,7 +88,7 @@
assertEquals(EXPECTED_SERVICE_COLLECTION_1, responseContent);
}
- public void testBeanWithEmptyParent() throws IOException {
+ public void testBeanWithEmptyParent() throws Exception {
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/emptyParent", MediaType.APPLICATION_ATOM_XML_TYPE);
MockHttpServletResponse response = invoke(mockRequest);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/DispatchErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/DispatchErrorTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/DispatchErrorTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/DispatchErrorTest.java Thu Jul 2 12:34:01 2009
@@ -20,8 +20,6 @@
package org.apache.wink.server;
-import java.io.IOException;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
@@ -60,19 +58,19 @@
}
- public void NotFound() throws IOException {
+ public void NotFound() throws Exception {
MockHttpServletResponse response = invoke(MockRequestConstructor.constructMockRequest(
"GET", "zzz", "*/*"));
assertEquals("status", HttpStatus.NOT_FOUND.getCode(), response.getStatus());
}
- public void testMethodNotAllowed() throws IOException {
+ public void testMethodNotAllowed() throws Exception {
MockHttpServletResponse response = invoke(MockRequestConstructor.constructMockRequest(
"GET", "path", "*/*"));
assertEquals("status", HttpStatus.METHOD_NOT_ALLOWED.getCode(), response.getStatus());
}
- public void testNotAcceptable() throws IOException {
+ public void testNotAcceptable() throws Exception {
MockHttpServletRequest servletRequest = MockRequestConstructor.constructMockRequest("PUT",
"path", "text/plain");
servletRequest.setContentType(MediaType.TEXT_HTML);
@@ -80,7 +78,7 @@
assertEquals("status", HttpStatus.NOT_ACCEPTABLE.getCode(), response.getStatus());
}
- public void testUnsupportedMediaType() throws IOException {
+ public void testUnsupportedMediaType() throws Exception {
MockHttpServletRequest servletRequest = MockRequestConstructor.constructMockRequest("PUT",
"path", MediaType.TEXT_XML);
servletRequest.setContentType("text/vnd.x-test");
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/JAXRSContextTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/JAXRSContextTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/JAXRSContextTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/JAXRSContextTest.java Thu Jul 2 12:34:01 2009
@@ -21,8 +21,6 @@
package org.apache.wink.server;
-import java.io.IOException;
-
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -96,7 +94,7 @@
}
}
- public void testUriInfoContext() throws IOException {
+ public void testUriInfoContext() throws Exception {
// TODO test all context fields
MockHttpServletResponse resp = invoke(MockRequestConstructor.constructMockRequest("GET",
"/context/uriInfo", "*/*"));
@@ -104,7 +102,7 @@
assertEquals("result", "context/uriInfo", result);
}
- public void testHttpHeadersContext() throws IOException {
+ public void testHttpHeadersContext() throws Exception {
// TODO test all context fields
MockHttpServletRequest mockRequest = MockRequestConstructor.constructMockRequest("GET",
"/context/httpHeaders", "*/*");
@@ -114,7 +112,7 @@
assertEquals("result", "Header Value", result);
}
- public void testRequestContext() throws IOException {
+ public void testRequestContext() throws Exception {
// TODO test all context fields
MockHttpServletResponse resp = invoke(MockRequestConstructor.constructMockRequest("GET",
"/context/request", "*/*"));
@@ -122,7 +120,7 @@
assertEquals("result", "GET", result);
}
- public void testSecurityContext() throws IOException {
+ public void testSecurityContext() throws Exception {
// TODO test all context fields
MockHttpServletResponse resp = invoke(MockRequestConstructor.constructMockRequest("GET",
"/context/security", "*/*"));
@@ -130,7 +128,7 @@
assertEquals("result", "true", result);
}
- public void testProvidersContext() throws IOException {
+ public void testProvidersContext() throws Exception {
// TODO test all context fields
MockHttpServletResponse resp = invoke(MockRequestConstructor.constructMockRequest("GET",
"/context/providers", "*/*"));
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/QueryTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/QueryTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/QueryTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/QueryTest.java Thu Jul 2 12:34:01 2009
@@ -17,10 +17,8 @@
* under the License.
*
*******************************************************************************/
-
-package org.apache.wink.server;
-import java.io.IOException;
+package org.apache.wink.server;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -31,8 +29,7 @@
import org.apache.wink.test.mock.MockRequestConstructor;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-
-
+
/**
* Tests @QueryParam.
*/
@@ -48,8 +45,7 @@
@GET
@Produces
- public String getQuery2(@QueryParam("q") String q,
- @QueryParam("b") String b,
+ public String getQuery2(@QueryParam("q") String q, @QueryParam("b") String b,
@QueryParam("c") String c) {
if (q == null && b == null && c == null) {
return "normal";
@@ -68,13 +64,13 @@
}
- public void testNoQuery() throws IOException {
+ public void testNoQuery() throws Exception {
MockHttpServletResponse resp = invoke(MockRequestConstructor.constructMockRequest("GET",
"/query", "*/*"));
assertEquals("result", "normal", resp.getContentAsString());
}
- public void testQueryWithOneParam() throws IOException {
+ public void testQueryWithOneParam() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/query", "*/*");
request.setQueryString("q=A");
@@ -82,7 +78,7 @@
assertEquals("result", "query1:A", resp.getContentAsString());
}
- public void testQueryWithNoParam() throws IOException {
+ public void testQueryWithNoParam() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/query", "*/*");
request.setQueryString("q=A&b=B");
@@ -90,7 +86,7 @@
assertEquals("result", "query2:q=A,b=B", resp.getContentAsString());
}
- public void testQueryOptional() throws IOException {
+ public void testQueryOptional() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/query", "*/*");
request.setQueryString("c=C");
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriConfigurationTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriConfigurationTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriConfigurationTest.java Thu Jul 2 12:34:01 2009
@@ -20,8 +20,6 @@
package org.apache.wink.server.internal;
-import java.io.IOException;
-
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -31,7 +29,7 @@
import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
import org.apache.wink.test.mock.MockRequestConstructor;
-import org.apache.wink.test.mock.SpringMockServletInvocationTest;
+import org.apache.wink.test.mock.TestUtils;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -60,11 +58,11 @@
@Override
protected String getPropertiesFile() {
String name = getClass().getName();
- String fileName = SpringMockServletInvocationTest.packageToPath(name) + ".properties";
+ String fileName = TestUtils.packageToPath(name) + ".properties";
return fileName;
}
- public void testDetection() throws IOException {
+ public void testDetection() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/con%20textPath/servle%20tPath/bas%20eUri", "*/*");
request.setSecure(false);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriDetectionTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriDetectionTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriDetectionTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/BaseUriDetectionTest.java Thu Jul 2 12:34:01 2009
@@ -20,8 +20,6 @@
package org.apache.wink.server.internal;
-import java.io.IOException;
-
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -57,7 +55,7 @@
} // class GetBaseUriResource
- public void testDetection() throws IOException {
+ public void testDetection() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/context/baseUri", "*/*");
request.setScheme("http");
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/CustomLocationHeaderConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/CustomLocationHeaderConfigurationTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/CustomLocationHeaderConfigurationTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/CustomLocationHeaderConfigurationTest.java Thu Jul 2 12:34:01 2009
@@ -35,7 +35,7 @@
import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
import org.apache.wink.test.mock.MockRequestConstructor;
-import org.apache.wink.test.mock.SpringMockServletInvocationTest;
+import org.apache.wink.test.mock.TestUtils;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -73,7 +73,7 @@
@Override
protected String getPropertiesFile() {
String name = getClass().getName();
- String fileName = SpringMockServletInvocationTest.packageToPath(name) + ".properties";
+ String fileName = TestUtils.packageToPath(name) + ".properties";
return fileName;
}
@@ -94,7 +94,7 @@
}
}
- public void testLocationHeaderExists() throws IOException {
+ public void testLocationHeaderExists() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/locationHeader/exist", "text/xml");
request.setSecure(false);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DefaultLocationHeaderConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DefaultLocationHeaderConfigurationTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DefaultLocationHeaderConfigurationTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DefaultLocationHeaderConfigurationTest.java Thu Jul 2 12:34:01 2009
@@ -20,7 +20,6 @@
package org.apache.wink.server.internal;
-import java.io.IOException;
import java.net.URI;
import javax.ws.rs.GET;
@@ -68,7 +67,7 @@
}
}
- public void testLocationHeaderMissing() throws IOException {
+ public void testLocationHeaderMissing() throws Exception {
MockHttpServletRequest request =
MockRequestConstructor.constructMockRequest("GET", "/locationHeader/missing", "text/plain");
request.setSecure(false);
@@ -78,7 +77,7 @@
assertTrue(response.getHeader(HttpHeaders.LOCATION) == null);
}
- public void testLocationHeaderExists() throws IOException {
+ public void testLocationHeaderExists() throws Exception {
MockHttpServletRequest request =
MockRequestConstructor.constructMockRequest("GET", "/locationHeader/exist", "text/xml");
request.setSecure(false);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DispatchIPv6Test.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DispatchIPv6Test.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DispatchIPv6Test.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/DispatchIPv6Test.java Thu Jul 2 12:34:01 2009
@@ -20,18 +20,17 @@
package org.apache.wink.server.internal;
-import java.io.IOException;
-import java.io.StringReader;
-import java.net.URI;
-import java.util.Date;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
+import java.io.StringReader;
+import java.net.URI;
+import java.util.Date;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
import org.apache.wink.common.RestConstants;
import org.apache.wink.common.annotations.Workspace;
import org.apache.wink.common.http.HttpStatus;
@@ -49,9 +48,9 @@
import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
import org.apache.wink.server.utils.LinkBuilders;
import org.apache.wink.test.mock.MockRequestConstructor;
-import org.apache.wink.test.mock.SpringMockServletInvocationTest;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
+import org.apache.wink.test.mock.TestUtils;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
/**
@@ -73,7 +72,7 @@
@Override
protected String getPropertiesFile() {
String name = getClass().getName();
- String fileName = SpringMockServletInvocationTest.packageToPath(name) + ".properties";
+ String fileName = TestUtils.packageToPath(name) + ".properties";
return fileName;
}
@@ -116,7 +115,7 @@
}
}
- public void testIPv6HttpServiceDocument() throws IOException {
+ public void testIPv6HttpServiceDocument() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET", "/",
MediaTypeUtils.ATOM_SERVICE_DOCUMENT_TYPE);
MockHttpServletResponse response = invoke(request);
@@ -129,7 +128,7 @@
assertTrue("ipv6 URI: " + href, href.startsWith(http));
}
- public void testIPv6HttpsServiceDocument() throws IOException {
+ public void testIPv6HttpsServiceDocument() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET", "/",
MediaTypeUtils.ATOM_SERVICE_DOCUMENT_TYPE);
request.setSecure(true);
@@ -143,7 +142,7 @@
assertTrue("ipv6 URI: " + href, href.startsWith(https));
}
- public void testIPv6HttpEntry() throws IOException {
+ public void testIPv6HttpEntry() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/get/entry", MediaType.APPLICATION_ATOM_XML_TYPE);
request.addParameter(RestConstants.REST_PARAM_ABSOLUTE_URLS, "");
@@ -155,7 +154,7 @@
assertTrue("ipv6 URI: " + link, link.getHref().startsWith(http));
}
- public void testIPv6HttpsEntry() throws IOException {
+ public void testIPv6HttpsEntry() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/get/entry", MediaType.APPLICATION_ATOM_XML_TYPE);
request.setSecure(true);
@@ -168,7 +167,7 @@
assertTrue("ipv6 URI: " + link, link.getHref().startsWith(https));
}
- public void testIPv6HttpFeed() throws IOException {
+ public void testIPv6HttpFeed() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/get/feed", MediaType.APPLICATION_ATOM_XML_TYPE);
request.addParameter(RestConstants.REST_PARAM_ABSOLUTE_URLS, "");
@@ -180,7 +179,7 @@
assertTrue("ipv6 URI: " + link, link.getHref().startsWith(http));
}
- public void testIPv6HttpsFeed() throws IOException {
+ public void testIPv6HttpsFeed() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"/get/feed", MediaType.APPLICATION_ATOM_XML_TYPE);
request.setSecure(true);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/HeadTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/HeadTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/HeadTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/HeadTest.java Thu Jul 2 12:34:01 2009
@@ -20,8 +20,6 @@
package org.apache.wink.server.internal;
-import java.io.IOException;
-
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -58,7 +56,7 @@
}
- public void testHead() throws IOException {
+ public void testHead() throws Exception {
MockHttpServletRequest getRequest = MockRequestConstructor.constructMockRequest("GET",
PATH, "*/*");
MockHttpServletResponse getResponse = invoke(getRequest);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/NoContentTypePostTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/NoContentTypePostTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/NoContentTypePostTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/NoContentTypePostTest.java Thu Jul 2 12:34:01 2009
@@ -20,8 +20,6 @@
package org.apache.wink.server.internal;
-import java.io.IOException;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -56,7 +54,7 @@
}
- public void testPostWithoutContentType() throws IOException {
+ public void testPostWithoutContentType() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("POST", "t",
"*/*");
MockHttpServletResponse response = invoke(request);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/ParameterConversionTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/ParameterConversionTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/ParameterConversionTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/ParameterConversionTest.java Thu Jul 2 12:34:01 2009
@@ -230,137 +230,124 @@
// --- test methods ---
// Boolean
- public void testBooleanPath() throws IOException {
+ public void testBooleanPath() throws Exception {
assertInvocation(constructPathRequest("true", "p/bigBoolean"));
}
- public void testBooleanArrayQuery() throws IOException {
+ public void testBooleanArrayQuery() throws Exception {
Boolean[] ia = {true, true, false, true};
QueryResource.expectedValues = ia;
assertInvocation(constructQueryArrayRequest(new String[]{"true", "true", "false", "true"}, "q/bigBooleanArray"));
}
- public void testBooleanQuery() throws IOException {
+ public void testBooleanQuery() throws Exception {
assertInvocation(constructQueryRequest(null, "q/bigBoolean"));
}
// boolean
- public void testBoolPath() throws IOException {
+ public void testBoolPath() throws Exception {
assertInvocation(constructPathRequest("true", "p/bool"));
}
- public void testBoolQuery() throws IOException {
+ public void testBoolQuery() throws Exception {
assertInvocation(constructQueryRequest(null, "q/bool"));
}
- public void testBoolArrayQuery() throws IOException {
+ public void testBoolArrayQuery() throws Exception {
boolean[] ia = {true, false, true, true};
QueryResource.expectedValues = ia;
assertInvocation(constructQueryArrayRequest(new String[]{"true", "false", "true", "true"}, "q/booleanArray"));
}
// Integer
- public void testIntQuery() throws IOException {
+ public void testIntQuery() throws Exception {
assertInvocation(constructQueryRequest("42", "q/int"));
}
- public void testIntergerArrayQuery() throws IOException {
+ public void testIntergerArrayQuery() throws Exception {
Integer[] ia = {new Integer("1"), new Integer("2"), new Integer("3"), new Integer("4"), new Integer("5")};
QueryResource.expectedValues = ia;
assertInvocation(constructQueryArrayRequest(new String[]{"1", "2", "3", "4", "5"}, "q/IntegerArray"));
}
// int
- public void testIntPath() throws IOException {
+ public void testIntPath() throws Exception {
assertInvocation(constructPathRequest("42", "p/int"));
}
- public void testNullIntArrayQuery() throws IOException {
+ public void testNullIntArrayQuery() throws Exception {
int[] ia = {};
QueryResource.expectedValues = ia;
assertInvocation(constructQueryArrayRequest(null, "q/intArray"));
}
- public void testIntArrayQuery() throws IOException {
+ public void testIntArrayQuery() throws Exception {
int[] ia = {1, 2, 3, 4, 5};
QueryResource.expectedValues = ia;
assertInvocation(constructQueryArrayRequest(new String[]{"1", "2", "3", "4", "5"}, "q/intArray"));
}
- public void testBigIntegerPath() throws IOException {
+ public void testBPI() throws Exception {
assertInvocation(constructPathRequest("42", "p/bigInteger"));
- }
-
- // Byte
- public void testBigBytePath() throws IOException {
assertInvocation(constructPathRequest("42", "p/bigByte"));
}
- public void testByteArrayQuery() throws IOException {
+
+ public void testByteArrayQuery() throws Exception {
QueryResource.expectedValues = new Byte[]{new Byte("1"), new Byte("2"), new Byte("3"), new Byte("4"),
new Byte("5")};
assertInvocation(constructQueryArrayRequest(new String[]{"1", "2", "3", "4", "5"}, "q/bigByteArray"));
}
// byte
- public void testByteQuery() throws IOException {
+ public void testByteQuery() throws Exception {
assertInvocation(constructQueryRequest("42", "q/byte"));
}
- public void testByteiArrayQuery() throws IOException {
+ public void testByteiArrayQuery() throws Exception {
QueryResource.expectedValues = new byte[]{1, 2, 3, 4, 5};
assertInvocation(constructQueryArrayRequest(new String[]{"1", "2", "3", "4", "5"}, "q/byteArray"));
}
- public void testMissingByteQuery() throws IOException {
+ public void testMissingBQ() throws Exception {
assertInvocation(constructQueryRequest(null, "q/byteMissing"));
- }
-
- // Short
- public void testBigShortQuery() throws IOException {
assertInvocation((constructQueryRequest(null, "q/bigShort")));
}
- public void testShortArrayQuery() throws IOException {
+
+
+ public void testShortArrayQuery() throws Exception {
Short[] ia = {new Short("1"), new Short("2"), new Short("3"), new Short("4"), new Short("5")};
QueryResource.expectedValues = ia;
assertInvocation(constructQueryArrayRequest(new String[]{"1", "2", "3", "4", "5"}, "q/bigShortArray"));
}
// short
- public void testShortPath() throws IOException {
+ public void testShortPath() throws Exception {
assertInvocation(constructPathRequest("42", "p/short"));
}
- public void testShortiArrayQuery() throws IOException {
+ public void testShortiArrayQuery() throws Exception {
short[] ia = {1, 2, 3, 4, 5};
QueryResource.expectedValues = ia;
assertInvocation(constructQueryArrayRequest(new String[]{"1", "2", "3", "4", "5"}, "q/shortArray"));
}
- // Long
- public void testLongQuery() throws IOException {
+ public void testLP() throws Exception {
assertInvocation(constructQueryRequest("43", "q/bigLong"));
- }
-
- // long
- public void testLongiPath() throws IOException {
assertInvocation(constructPathRequest("43", "p/long"));
- }
-
- // Double
- public void testDoubleQuery() throws IOException {
assertInvocation(constructQueryRequest("1.0", "q/bigDouble"));
}
- public void testDoubleArrayQuery() throws IOException {
+
+ public void testDoubleArrayQuery() throws Exception {
Double[] ia = {new Double("1"), new Double("2"), new Double("3"), new Double("4"), new Double("5")};
QueryResource.expectedValues = ia;
assertInvocation(constructQueryArrayRequest(new String[]{"1", "2", "3", "4", "5"}, "q/bigDoubleArray"));
}
// float
- public void testFloatPath() throws IOException {
+ public void testFloatPath() throws Exception {
assertInvocation(constructPathRequest("3.0", "p/float"));
}
@@ -370,7 +357,7 @@
return MockRequestConstructor.constructMockRequest("GET", "/p/" + UriEncoder.encodeString(varValue), method);
}
- private void assertInvocation(MockHttpServletRequest servletRequest) throws IOException {
+ private void assertInvocation(MockHttpServletRequest servletRequest) throws Exception {
MockHttpServletResponse mockHttpServletResponse = invoke(servletRequest);
try {
assertEquals("http status", HttpStatus.NO_CONTENT.getCode(), mockHttpServletResponse.getStatus());
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/PreconditionsTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/PreconditionsTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/PreconditionsTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/PreconditionsTest.java Thu Jul 2 12:34:01 2009
@@ -20,7 +20,6 @@
package org.apache.wink.server.internal;
-import java.io.IOException;
import java.util.Date;
import java.util.GregorianCalendar;
@@ -146,7 +145,7 @@
} //
- public void testNormalGet() throws IOException {
+ public void testNormalGet() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET",
"get/0/null", "*/*");
MockHttpServletResponse response = invoke(request);
@@ -154,7 +153,7 @@
assertEquals("content", THE_CONTENT, response.getContentAsString());
}
- public void testConditionModified() throws IOException {
+ public void testConditionModified() throws Exception {
Date date_to_return = new GregorianCalendar(2007, 11, 06, 10, 0, 0).getTime();
Date modified_since = new GregorianCalendar(2007, 11, 07, 10, 0, 0).getTime();
@@ -173,7 +172,7 @@
assertEquals("status", 304, response.getStatus());
}
- public void testConditionNotModified() throws IOException {
+ public void testConditionNotModified() throws Exception {
Date date_to_return = new GregorianCalendar(2007, 11, 07, 10, 0, 0).getTime();
Date modified_since = new GregorianCalendar(2007, 11, 06, 10, 0, 0).getTime();
@@ -192,7 +191,7 @@
assertEquals("status", 200, response.getStatus());
}
- public void testConditionModifiedAndMatches() throws IOException {
+ public void testConditionModifiedAndMatches() throws Exception {
Date date_to_return = new GregorianCalendar(2007, 11, 07, 10, 0, 0).getTime();
Date modified_since = new GregorianCalendar(2007, 11, 06, 10, 0, 0).getTime();
String etag = "blablabla";
@@ -214,7 +213,7 @@
assertEquals("status", 200, response.getStatus());
}
- public void testConditionUnModifiedAndMatches() throws IOException {
+ public void testConditionUnModifiedAndMatches() throws Exception {
Date date_to_return = new GregorianCalendar(2007, 11, 07, 10, 0, 0).getTime();
Date modified_since = new GregorianCalendar(2007, 11, 06, 10, 0, 0).getTime();
String etag = "blablabla";
@@ -236,7 +235,7 @@
}
- public void testConditionIfMatches() throws IOException {
+ public void testConditionIfMatches() throws Exception {
String etag = "blablabla";
// GET
@@ -254,7 +253,7 @@
}
- public void testConditionGetNotIfMatches() throws IOException {
+ public void testConditionGetNotIfMatches() throws Exception {
String etag = "blablabla";
// GET
@@ -272,7 +271,7 @@
}
- public void testConditionIfNoneMatches() throws IOException {
+ public void testConditionIfNoneMatches() throws Exception {
String etag = "blablabla";
// GET
@@ -290,7 +289,7 @@
}
- public void testConditionNoteIfNoneMatches() throws IOException {
+ public void testConditionNoteIfNoneMatches() throws Exception {
String etag = "blablabla";
// GET
@@ -308,7 +307,7 @@
}
- public void testConditionalIfUnModified() throws IOException {
+ public void testConditionalIfUnModified() throws Exception {
Date date_to_return = new GregorianCalendar(2007, 11, 06, 10, 0, 0).getTime();
Date modified_since = new GregorianCalendar(2007, 11, 07, 10, 0, 0).getTime();
@@ -332,7 +331,7 @@
}
- public void testConditionalIfNotUnModified() throws IOException {
+ public void testConditionalIfNotUnModified() throws Exception {
Date date_to_return = new GregorianCalendar(2007, 11, 07, 10, 0, 0).getTime();
Date modified_since = new GregorianCalendar(2007, 11, 06, 10, 0, 0).getTime();
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/SlashEndingUriTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/SlashEndingUriTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/SlashEndingUriTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/SlashEndingUriTest.java Thu Jul 2 12:34:01 2009
@@ -20,8 +20,6 @@
package org.apache.wink.server.internal;
-import java.io.IOException;
-
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -73,7 +71,7 @@
} //
- public void testFinalSlash() throws IOException {
+ public void testFinalSlash() throws Exception {
final String withSlash = "service/hello/collection/subcollection/";
final String withoutSlash = withSlash.substring(0, withSlash.length() - 1);
@@ -90,7 +88,7 @@
response2.getContentAsString());
}
- public void testSeveralSlashes() throws IOException {
+ public void testSeveralSlashes() throws Exception {
final String withSlash = "service/hello/collection/subcollection/";
final String withSlash2 = withSlash + "/";
final String withSlash3 = withSlash2 + "/";
@@ -113,7 +111,7 @@
assertEquals("should end with slash", requestUriWithSlash, response.getContentAsString());
}
- public void testRootUri() throws IOException {
+ public void testRootUri() throws Exception {
final String requestUri = "http://localhost:8080/rest/";
MockHttpServletRequest request = null;
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/StreamResponseTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/StreamResponseTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/StreamResponseTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/StreamResponseTest.java Thu Jul 2 12:34:01 2009
@@ -75,7 +75,7 @@
} //
- public void testStreamResponse() throws IOException {
+ public void testStreamResponse() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET", "path",
MediaTypeUtils.IMAGE_JPEG_TYPE);
MockHttpServletResponse response = invoke(request);
@@ -86,7 +86,7 @@
}
}
- public void testReaderResponse() throws IOException {
+ public void testReaderResponse() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET", "path",
MediaType.TEXT_PLAIN_TYPE);
MockHttpServletResponse response = invoke(request);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/UnknownMimeTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/UnknownMimeTypeTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/UnknownMimeTypeTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/UnknownMimeTypeTest.java Thu Jul 2 12:34:01 2009
@@ -107,7 +107,7 @@
* @throws XmlException
* problem with parsing by xmlbeans
*/
- public void testGetUnknown() throws IOException {
+ public void testGetUnknown() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest(HttpMethod.GET.toString(),
"get/unknown", MediaType.WILDCARD);
MockHttpServletResponse response = invoke(request);
@@ -123,7 +123,7 @@
* @throws XmlException
* problem with parsing by xmlbeans
*/
- public void testGetPdf() throws IOException {
+ public void testGetPdf() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest(HttpMethod.GET.toString(), "get/"
+ PDF, MediaType.WILDCARD);
MockHttpServletResponse response = invoke(request);
@@ -132,7 +132,7 @@
}
// Test http://qcweb/qcweb/showBug.jsp?bug=39720
- public void testGetPdfWithConcreteType() throws IOException {
+ public void testGetPdfWithConcreteType() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest(HttpMethod.GET.toString(), "get/"
+ PDF, MediaTypeUtils.PDF);
MockHttpServletResponse response = invoke(request);
@@ -140,14 +140,14 @@
assertTrue("content type", response.getContentType().contains(MediaTypeUtils.PDF));
}
- public void testGetPdfWithWrongConreteType() throws IOException {
+ public void testGetPdfWithWrongConreteType() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest(HttpMethod.GET.toString(), "get/"
+ PDF, MediaType.APPLICATION_OCTET_STREAM);
MockHttpServletResponse response = invoke(request);
assertEquals("status", 406, response.getStatus());
}
- public void testAtomWithWrongConreteType() throws IOException {
+ public void testAtomWithWrongConreteType() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest(HttpMethod.GET.toString(),
"get/atom", MediaType.APPLICATION_OCTET_STREAM);
MockHttpServletResponse response = invoke(request);
@@ -157,7 +157,7 @@
/**
* Test that resource returns correct error code
*/
- public void testRestException() throws IOException {
+ public void testRestException() throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest(HttpMethod.GET.toString(), "get/"
+ THROW_EXCEPTION, MediaType.WILDCARD);
MockHttpServletResponse response = invoke(request);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/HttpHeadersImplTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/HttpHeadersImplTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/HttpHeadersImplTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/HttpHeadersImplTest.java Thu Jul 2 12:34:01 2009
@@ -19,7 +19,6 @@
*******************************************************************************/
package org.apache.wink.server.internal.jaxrs;
-import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -158,7 +157,7 @@
@Test
- public void testHttpHeaderContext() throws IOException {
+ public void testHttpHeaderContext() throws Exception {
MockHttpServletRequest servletRequest = MockRequestConstructor.constructMockRequest("GET", "/test", "application/xml;q=0.3, text/plain, text/html;q=0.5");
servletRequest.addHeader("Content-Type", "application/xml");
servletRequest.addHeader("Content-Language", "en-us, he");
@@ -172,7 +171,7 @@
}
@Test
- public void testHttpHeaderContextNegative() throws IOException {
+ public void testHttpHeaderContextNegative() throws Exception {
MockHttpServletRequest servletRequest = MockRequestConstructor.constructMockRequest("GET", "/test/negative", "*/*");
invoke(servletRequest);
}
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/UriInfoImplTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/UriInfoImplTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/UriInfoImplTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/jaxrs/UriInfoImplTest.java Thu Jul 2 12:34:01 2009
@@ -19,7 +19,6 @@
*******************************************************************************/
package org.apache.wink.server.internal.jaxrs;
-import java.io.IOException;
import java.util.List;
import javax.ws.rs.GET;
@@ -245,7 +244,7 @@
@Test
- public void testUriInfoMatchedResourcesAndURIs() throws IOException {
+ public void testUriInfoMatchedResourcesAndURIs() throws Exception {
MockHttpServletRequest servletRequest = MockRequestConstructor.constructMockRequest("GET", "/foo", "text/plain");
invoke(servletRequest);
@@ -263,7 +262,7 @@
}
@Test
- public void testUriInfo() throws IOException {
+ public void testUriInfo() throws Exception {
MockHttpServletRequest servletRequest = MockRequestConstructor.constructMockRequest("GET", "/te%20st/5", "text/plain");
servletRequest.setQueryString("abc=6");
invoke(servletRequest);
Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/EntityLocatorProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/EntityLocatorProviderTest.java?rev=790563&r1=790562&r2=790563&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/EntityLocatorProviderTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/EntityLocatorProviderTest.java Thu Jul 2 12:34:01 2009
@@ -19,9 +19,6 @@
*******************************************************************************/
package org.apache.wink.server.internal.providers.entity;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -40,7 +37,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-
public class EntityLocatorProviderTest extends MockServletInvocationTest {
private static final String ENTRY = "<entry xmlns=\"http://www.w3.org/2005/Atom\">\n"
@@ -151,7 +147,7 @@
postAtomEntry("/test/jaxbelement");
}
- private void getAtomEntry(String url) throws IOException, UnsupportedEncodingException {
+ private void getAtomEntry(String url) throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("GET", url,
"application/atom+xml");
MockHttpServletResponse response = invoke(request);
@@ -159,7 +155,7 @@
assertEquals(ENTRY, response.getContentAsString());
}
- private void postAtomEntry(String url) throws IOException, UnsupportedEncodingException {
+ private void postAtomEntry(String url) throws Exception {
MockHttpServletRequest request = MockRequestConstructor.constructMockRequest("POST", url,
"application/atom+xml");
request.setContentType("application/atom+xml");