httpunit/httpunit-servlet31.patch
2020-08-29 11:19:10 +08:00

475 lines
15 KiB
Diff
Raw Blame History

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<74>mper
+ // by Timo Westk<74>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");
+ }
+ }
}