public void testMultipartRequest() throws IOException, ServletException
{
MultipartFilter filter = new MultipartFilter();
ServletContext context = new MockServletContext();
HttpSession session = new MockHttpSession(context);
MockHttpServletRequest request = new MockHttpServletRequest(session, "Pete", new HashSet<String>(), new Cookie[0], "post")
{
private final InputStream is = Resources.getResourceAsStream("/META-INF/seam.properties", null);
@Override
public String getContentType()
{
return "multipart/test; boundary=foo";
}
@Override
public ServletInputStream getInputStream() throws IOException
{
return new ServletInputStream() {
@Override
public int read() throws IOException
{
return is.read();
}
@Override
public int read(byte[] b) throws IOException
{
return is.read(b);
}
};
}
};
// Add some parameters to test passthrough
String [] fooParams = {"bar"};
request.getParameterMap().put("foo", fooParams);
ServletResponse response = new MockHttpServletResponse();
FilterChain chain = new FilterChain()
{
public void doFilter(ServletRequest request, ServletResponse response)