[httpunit] Port to servlet 3.1
Michal Srb
msrb at fedoraproject.org
Tue Mar 10 10:02:09 UTC 2015
commit 1212c175f4a42d17c786682f3a677a3246e18d8d
Author: Michal Srb <msrb at redhat.com>
Date: Tue Mar 10 10:42:29 2015 +0100
Port to servlet 3.1
httpunit-not-implemented.patch | 422 ------------------------------------
httpunit-servlet31.patch | 474 +++++++++++++++++++++++++++++++++++++++++
httpunit.spec | 7 +-
3 files changed, 479 insertions(+), 424 deletions(-)
---
diff --git a/httpunit-servlet31.patch b/httpunit-servlet31.patch
new file mode 100644
index 0000000..dc319b4
--- /dev/null
+++ b/httpunit-servlet31.patch
@@ -0,0 +1,474 @@
+diff --git a/src/com/meterware/servletunit/ServletInputStreamImpl.java b/src/com/meterware/servletunit/ServletInputStreamImpl.java
+index 33ff39f..628d940 100644
+--- a/src/com/meterware/servletunit/ServletInputStreamImpl.java
++++ b/src/com/meterware/servletunit/ServletInputStreamImpl.java
+@@ -22,6 +22,7 @@ package com.meterware.servletunit;
+ import java.io.IOException;
+ import java.io.ByteArrayInputStream;
+
++import javax.servlet.ReadListener;
+ import javax.servlet.ServletInputStream;
+
+
+@@ -44,4 +45,15 @@ class ServletInputStreamImpl extends ServletInputStream {
+ return _baseStream.read();
+ }
+
++ public boolean isFinished() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public boolean isReady() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public void setReadListener(ReadListener arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
+ }
+diff --git a/src/com/meterware/servletunit/ServletUnitHttpRequest.java b/src/com/meterware/servletunit/ServletUnitHttpRequest.java
+index c2c331e..1f91ca0 100644
+--- a/src/com/meterware/servletunit/ServletUnitHttpRequest.java
++++ b/src/com/meterware/servletunit/ServletUnitHttpRequest.java
+@@ -33,10 +33,18 @@ import java.util.*;
+
+ import javax.servlet.http.HttpServletRequest;
+ import javax.servlet.http.Cookie;
++import javax.servlet.http.HttpServletResponse;
+ import javax.servlet.http.HttpSession;
++import javax.servlet.http.HttpUpgradeHandler;
++import javax.servlet.http.Part;
++import javax.servlet.AsyncContext;
++import javax.servlet.DispatcherType;
++import javax.servlet.ServletContext;
+ import javax.servlet.ServletInputStream;
+ import javax.servlet.RequestDispatcher;
+ import javax.servlet.ServletException;
++import javax.servlet.ServletRequest;
++import javax.servlet.ServletResponse;
+
+
+ /**
+@@ -886,6 +894,79 @@ class ServletUnitHttpRequest implements HttpServletRequest {
+ }
+
+ }
+-}
+
+
++ public AsyncContext getAsyncContext() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public long getContentLengthLong() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public DispatcherType getDispatcherType() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public ServletContext getServletContext() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public boolean isAsyncStarted() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public boolean isAsyncSupported() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public AsyncContext startAsync() throws IllegalStateException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public AsyncContext startAsync(ServletRequest arg0, ServletResponse arg1) throws IllegalStateException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public boolean authenticate(HttpServletResponse arg0) throws IOException, ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public String changeSessionId() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Part getPart(String arg0) throws IOException, ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Collection getParts() throws IOException, ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public void login(String arg0, String arg1) throws ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public void logout() throws ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public HttpUpgradeHandler upgrade(Class arg0) throws IOException, ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++}
+diff --git a/src/com/meterware/servletunit/ServletUnitHttpResponse.java b/src/com/meterware/servletunit/ServletUnitHttpResponse.java
+index bcf7236..7f61598 100644
+--- a/src/com/meterware/servletunit/ServletUnitHttpResponse.java
++++ b/src/com/meterware/servletunit/ServletUnitHttpResponse.java
+@@ -26,11 +26,11 @@ import java.io.IOException;
+ import java.io.OutputStreamWriter;
+ import java.io.PrintWriter;
+ import java.io.UnsupportedEncodingException;
+-
+ import java.util.*;
+ import java.text.SimpleDateFormat;
+
+ import javax.servlet.ServletOutputStream;
++import javax.servlet.WriteListener;
+ import javax.servlet.http.Cookie;
+ import javax.servlet.http.HttpServletResponse;
+
+@@ -463,7 +463,7 @@ class ServletUnitHttpResponse implements HttpServletResponse {
+ /**
+ * Returns the status of this response.
+ **/
+- int getStatus() {
++ public int getStatus() {
+ return _status;
+ }
+
+@@ -602,6 +602,27 @@ class ServletUnitHttpResponse implements HttpServletResponse {
+ ENCODING_MAP.put("Big5", "zh_TW zh_HK " );
+ }
+
++
++
++ public void setContentLengthLong(long arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public String getHeader(String arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Collection getHeaderNames() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Collection getHeaders(String arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
+ }
+
+
+@@ -618,4 +639,13 @@ class ServletUnitOutputStream extends ServletOutputStream {
+ }
+
+ private ByteArrayOutputStream _stream;
++
++ public boolean isReady() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public void setWriteListener(WriteListener arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
+ }
+diff --git a/src/com/meterware/servletunit/ServletUnitServletContext.java b/src/com/meterware/servletunit/ServletUnitServletContext.java
+index 101bfb4..b532b8c 100644
+--- a/src/com/meterware/servletunit/ServletUnitServletContext.java
++++ b/src/com/meterware/servletunit/ServletUnitServletContext.java
+@@ -28,12 +28,21 @@ import java.net.MalformedURLException;
+ import java.net.URL;
+ import java.net.URLConnection;
+ import java.util.Enumeration;
++import java.util.EventListener;
+ import java.util.Hashtable;
++import java.util.Map;
+ import java.util.Set;
+ import java.util.Vector;
+
++import javax.servlet.Filter;
++import javax.servlet.FilterRegistration;
++import javax.servlet.FilterRegistration.Dynamic;
++import javax.servlet.Servlet;
+ import javax.servlet.ServletContext;
+ import javax.servlet.ServletException;
++import javax.servlet.ServletRegistration;
++import javax.servlet.SessionCookieConfig;
++import javax.servlet.descriptor.JspConfigDescriptor;
+
+
+
+@@ -116,7 +125,7 @@ public class ServletUnitServletContext implements ServletContext {
+ try {
+ File resourceFile = _application.getResourceFile( path );
+ // PATCH proposal [ 1592532 ] Invalid ServletUnitServletContext#getResource(String path)
+- // by Timo Westkämper
++ // by Timo Westk�mper
+ // return !resourceFile.exists() ? null : resourceFile.toURL();
+ return resourceFile == null ? null : resourceFile.toURL();
+ } catch (MalformedURLException e) {
+@@ -400,4 +409,140 @@ public class ServletUnitServletContext implements ServletContext {
+ public void setLogStream(PrintStream logStream) {
+ this._logStream = logStream;
+ }
++
++
++ public Dynamic addFilter(String arg0, String arg1) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Dynamic addFilter(String arg0, Filter arg1) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Dynamic addFilter(String arg0, Class arg1) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public void addListener(String arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public void addListener(EventListener arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public void addListener(Class arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0, String arg1) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0, Servlet arg1) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
++ Class arg1) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Filter createFilter(Class arg0) throws ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public EventListener createListener(Class arg0) throws ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Servlet createServlet(Class arg0) throws ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public void declareRoles(String[] arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public ClassLoader getClassLoader() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Set getDefaultSessionTrackingModes() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public int getEffectiveMajorVersion() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public int getEffectiveMinorVersion() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Set getEffectiveSessionTrackingModes() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public FilterRegistration getFilterRegistration(String arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Map getFilterRegistrations() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public JspConfigDescriptor getJspConfigDescriptor() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public ServletRegistration getServletRegistration(String arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public Map getServletRegistrations() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public SessionCookieConfig getSessionCookieConfig() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public String getVirtualServerName() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public boolean setInitParameter(String arg0, String arg1) {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++
++ public void setSessionTrackingModes(Set arg0) {
++ throw new UnsupportedOperationException("not implemented");
++ }
+ }
+diff --git a/test/com/meterware/servletunit/RequestContextTest.java b/test/com/meterware/servletunit/RequestContextTest.java
+index ec0f4d4..d96ebab 100644
+--- a/test/com/meterware/servletunit/RequestContextTest.java
++++ b/test/com/meterware/servletunit/RequestContextTest.java
+@@ -22,6 +22,7 @@ package com.meterware.servletunit;
+ import com.meterware.httpunit.HttpUnitTest;
+
+ import java.net.URL;
++import java.util.Collection;
+ import java.util.Enumeration;
+ import java.util.Map;
+ import java.util.Locale;
+@@ -32,9 +33,18 @@ import java.io.BufferedReader;
+
+ import javax.servlet.http.HttpServletRequest;
+ import javax.servlet.http.Cookie;
++import javax.servlet.http.HttpServletResponse;
+ import javax.servlet.http.HttpSession;
++import javax.servlet.http.HttpUpgradeHandler;
++import javax.servlet.http.Part;
++import javax.servlet.AsyncContext;
++import javax.servlet.DispatcherType;
++import javax.servlet.ServletContext;
++import javax.servlet.ServletException;
+ import javax.servlet.ServletInputStream;
+ import javax.servlet.RequestDispatcher;
++import javax.servlet.ServletRequest;
++import javax.servlet.ServletResponse;
+
+ import junit.framework.TestSuite;
+
+@@ -384,7 +394,65 @@ public class RequestContextTest extends HttpUnitTest {
+ public int getLocalPort() {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+- }
+
++ public AsyncContext getAsyncContext() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public long getContentLengthLong() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public DispatcherType getDispatcherType() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public ServletContext getServletContext() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public boolean isAsyncStarted() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public boolean isAsyncSupported() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public AsyncContext startAsync() throws IllegalStateException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public AsyncContext startAsync(ServletRequest arg0, ServletResponse arg1) throws IllegalStateException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public boolean authenticate(HttpServletResponse arg0) throws IOException, ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public String changeSessionId() {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public Part getPart(String arg0) throws IOException, ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
+
++ public Collection getParts() throws IOException, ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public void login(String arg0, String arg1) throws ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public void logout() throws ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++
++ public HttpUpgradeHandler upgrade(Class arg0) throws IOException, ServletException {
++ throw new UnsupportedOperationException("not implemented");
++ }
++ }
+ }
diff --git a/httpunit.spec b/httpunit.spec
index b27ccf5..4483077 100644
--- a/httpunit.spec
+++ b/httpunit.spec
@@ -30,7 +30,7 @@
Name: httpunit
Version: 1.7
-Release: 16%{?dist}
+Release: 17%{?dist}
Epoch: 0
Summary: Automated web site testing toolkit
License: MIT and ASL 2.0
@@ -45,7 +45,7 @@ Source4: https://raw.github.com/apache/tomcat/TOMCAT_7_0_42/java/javax/se
Source5: http://www.apache.org/licenses/LICENSE-2.0.txt
Patch1: %{name}-JavaScript-NotAFunctionException.patch
Patch2: %{name}-servlettest.patch
-Patch3: %{name}-not-implemented.patch
+Patch3: %{name}-servlet31.patch
Patch4: junit4.patch
URL: http://httpunit.sourceforge.net/
BuildRequires: jpackage-utils >= 0:1.6
@@ -160,6 +160,9 @@ popd
%doc doc/*
%changelog
+* Mon Mar 09 2015 Michal Srb <msrb at redhat.com> - 0:1.7-17
+- Port to servlet 3.1
+
* Thu Mar 5 2015 Alexander Kurtakov <akurtako at redhat.com> 0:1.7-16
- Rebuild for servlet 3.1.
More information about the scm-commits
mailing list