Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.mock
Class MockMultipartRequestHandler

    java.lang.Object
      org.apache.struts.mock.MockMultipartRequestHandler

All Implemented Interfaces:
  MultipartRequestHandler

    public class MockMultipartRequestHandler

extends Object
implements MultipartRequestHandler

Mock MultipartRequestHandler object for unit tests.

Version:
  $Rev: 471754 $

Field Summary

Fields inherited from interface org.apache.struts.upload.MultipartRequestHandler
`ATTRIBUTE_MAX_LENGTH_EXCEEDED`

Constructor Summary
`MockMultipartRequestHandler()`

Method Summary
`void` | `finish()` Mock `finish()` method does nothing.
`Hashtable` | `getAllElements()` This method returns all elements of a multipart request.
`Hashtable` | `getFileElements()` This method is called on to retrieve all the FormFile input elements of the request.
`ActionMapping` | `getMapping()` Get the ActionMapping instance for this mock request.
`ActionServlet` | `getServlet()` Get the mock ActionServlet instance.
`Hashtable` | `getTextElements()` This method is called on to retrieve all the text input elements of the request.
`void` | `handleRequest(HttpServletRequest request)` Mock parsing of the ServletInputStream.
`void` | `rollback()` Mock `rollback()` method does nothing.
`void` | `setMapping(ActionMapping mapping)` Convienience method to set a reference to a mock ActionMapping instance.
`void` | `setServlet(ActionServlet servlet)` Convienience method to set a reference to a mock ActionServlet instance.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MockMultipartRequestHandler

    public MockMultipartRequestHandler()

Method Detail

### setServlet

    public void setServlet(ActionServlet servlet)

  Convienience method to set a reference to a mock ActionServlet instance.

  Specified by:
    `setServlet` in interface `MultipartRequestHandler`
  Parameters:
    `servlet` - Mock servlet instance.

### setMapping

    public void setMapping(ActionMapping mapping)

  Convienience method to set a reference to a mock ActionMapping instance.

  Specified by:
    `setMapping` in interface `MultipartRequestHandler`
  Parameters:
    `mapping` - Mock action mapping instance.

### getServlet

    public ActionServlet getServlet()

  Get the mock ActionServlet instance.

  Specified by:
    `getServlet` in interface `MultipartRequestHandler`
  Returns:
    The mock servlet instance.

### getMapping

    public ActionMapping getMapping()

  Get the ActionMapping instance for this mock request.

  Specified by:
    `getMapping` in interface `MultipartRequestHandler`
  Returns:
    The mock action mapping instance.

### handleRequest

    public void handleRequest(HttpServletRequest request)
                       throws ServletException

  Mock parsing of the ServletInputStream.

  Constructs a `Hashtable` of elements from the HttpServletRequest's parameters - no `FormFile` elements are created.

  Specified by:
    `handleRequest` in interface `MultipartRequestHandler`
  Parameters:
    `request` - Mock request instance.
  Throws:
    `ServletException` - If there is a problem with processing the request.

### getTextElements

    public Hashtable getTextElements()

  This method is called on to retrieve all the text input elements of the request.

  Specified by:
    `getTextElements` in interface `MultipartRequestHandler`
  Returns:
    A Hashtable where the keys and values are the names and values of the request input parameters

### getFileElements

    public Hashtable getFileElements()

  This method is called on to retrieve all the FormFile input elements of the request.

  Specified by:
    `getFileElements` in interface `MultipartRequestHandler`
  Returns:
    This mock implementation returns an empty `Hashtable`
  See Also:
    `FormFile`

### getAllElements

    public Hashtable getAllElements()

  This method returns all elements of a multipart request.

  Specified by:
    `getAllElements` in interface `MultipartRequestHandler`
  Returns:
    This mock implementation returns a Hashtable where the keys are input names and values are either Strings (no FormFile elements)

### rollback

    public void rollback()

  Mock `rollback()` method does nothing.

  Specified by:
    `rollback` in interface `MultipartRequestHandler`

### finish

    public void finish()

  Mock `finish()` method does nothing.

  Specified by:
    `finish` in interface `MultipartRequestHandler`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.