za.org.coefficient.util.testing
Class CoefficientTestingContext

java.lang.Object
  extended by za.org.coefficient.core.BaseCoefficientContext
      extended by za.org.coefficient.util.testing.CoefficientTestingContext
All Implemented Interfaces:
java.io.Serializable, za.co.csir.icomtek.workflow.interfaces.WorkflowContext, CoefficientContext

public class CoefficientTestingContext
extends BaseCoefficientContext
implements java.io.Serializable

Project: coefficient

Description: This is an implementation of the CoefficientContext that is backed by a Map for the session data, and 2 more for the request and request attribute data - this makes it useful for running unit tests.

Copyright: Copyright (c) 2003

Company: CSIR

Version:
1.0
Author:
tfogwill
See Also:
Serialized Form

Field Summary
private static java.lang.String REQUEST_ATTR_KEY
           
private static java.lang.String REQUEST_DATA_KEY
           
private static java.lang.String SESSION_KEY
           
private static java.lang.String USERNAME_KEY
           
 
Fields inherited from class za.org.coefficient.core.BaseCoefficientContext
CURRENT_PROJECT, domain, fileUploadData, invalidateSession, inWorkflowAction, LAST_NON_HELP_OP, multipartRequest, page_, redirectionURL, removedSessionKeys, requestAttributes, requestData, requestURL, serializableExistingCookies, serializableNewCookies, session, URL_PREFIX
 
Constructor Summary
CoefficientTestingContext(org.apache.commons.collections.ExtendedProperties properties)
          CoefficientTestingContext constructor
CoefficientTestingContext(org.apache.commons.collections.ExtendedProperties properties, java.util.Map fileUploadData)
          CoefficientTestingContext constructor
CoefficientTestingContext(java.util.Map session, java.util.Map requestData, java.util.Map requestAttributes)
          constructor that includes fileupload data
CoefficientTestingContext(java.util.Map session, java.util.Map requestData, java.util.Map requestAttributes, java.util.Map fileUploadData)
          constructor that includes fileupload data
CoefficientTestingContext(java.lang.String filename)
          CoefficientTestingContext constructor
CoefficientTestingContext(java.lang.String filename, java.util.Map fileUploadData)
          CoefficientTestingContext constructor
 
Method Summary
 BaseMultipartRequest getMultipartRequest()
           
 java.lang.String getRequestURL()
           
private  void setupUser(org.apache.commons.collections.ExtendedProperties properties)
           
 
Methods inherited from class za.org.coefficient.core.BaseCoefficientContext
beginWorkflowAction, clearModuleContent, clearPage, createPageObject, endWorkflowAction, getCookies, getCurrentUser, getLastNonHelpOp, getPage, getParameter, getParameter, getParameterAsBoolean, getParameterAsDate, getParameterAsDouble, getParameterAsDouble, getParameterAsDoublePrimitive, getParameterAsInt, getParameterAsInteger, getParameterAsInteger, getParameterAsLong, getParameterAsLong, getParameterAsLongPrimitive, getParametersValues, getParameterValues, getParameterValuesLong, getProject, getRequestAttribute, getRequestAttributes, getRequestData, getSession, getSessionAttribute, getTheme, getUploadedFile, invalidateSession, isError, removeRequestAttribute, removeSessionAttribute, setCookie, setError, setForward, setForward, setForward, setModuleContent, setModuleContent, setProject, setProperties, setProperty, setRequestAttribute, setRequestAttributes, setRequestData, setSession, setSessionAttribute, setTheme, setWorkflowUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUEST_DATA_KEY

private static final java.lang.String REQUEST_DATA_KEY
See Also:
Constant Field Values

REQUEST_ATTR_KEY

private static final java.lang.String REQUEST_ATTR_KEY
See Also:
Constant Field Values

SESSION_KEY

private static final java.lang.String SESSION_KEY
See Also:
Constant Field Values

USERNAME_KEY

private static final java.lang.String USERNAME_KEY
See Also:
Constant Field Values
Constructor Detail

CoefficientTestingContext

public CoefficientTestingContext(java.lang.String filename)
                          throws java.io.IOException
CoefficientTestingContext constructor

Parameters:
filename - of the properties file containing the request and session data
Throws:
java.io.IOException - if the file cannot be read

CoefficientTestingContext

public CoefficientTestingContext(java.lang.String filename,
                                 java.util.Map fileUploadData)
                          throws java.io.IOException
CoefficientTestingContext constructor

Parameters:
filename - of the properties file containing the request and session data
fileUploadData - The map containing the fileupload data (String name/uploadedfile fileData)
Throws:
java.io.IOException - if the file cannot be read

CoefficientTestingContext

public CoefficientTestingContext(org.apache.commons.collections.ExtendedProperties properties)
CoefficientTestingContext constructor

Parameters:
properties - properties object containing the request and session data

CoefficientTestingContext

public CoefficientTestingContext(org.apache.commons.collections.ExtendedProperties properties,
                                 java.util.Map fileUploadData)
CoefficientTestingContext constructor

Parameters:
properties - properties object containing the request and session data
fileUploadData - The map containing the fileupload data (String name/uploadedfile fileData)

CoefficientTestingContext

public CoefficientTestingContext(java.util.Map session,
                                 java.util.Map requestData,
                                 java.util.Map requestAttributes)
constructor that includes fileupload data

Parameters:
session - Map containing session data
requestData - Map containing reqest paramter data
requestAttributes - Map containing request attribute data
fileUploadData - Map containing file upload data data

CoefficientTestingContext

public CoefficientTestingContext(java.util.Map session,
                                 java.util.Map requestData,
                                 java.util.Map requestAttributes,
                                 java.util.Map fileUploadData)
constructor that includes fileupload data

Parameters:
session - Map containing session data
requestData - Map containing reqest paramter data
requestAttributes - Map containing request attribute data
fileUploadData - Map containing file upload data data
Method Detail

getMultipartRequest

public BaseMultipartRequest getMultipartRequest()
                                         throws org.apache.commons.fileupload.FileUploadException
Specified by:
getMultipartRequest in interface CoefficientContext
Overrides:
getMultipartRequest in class BaseCoefficientContext
Throws:
org.apache.commons.fileupload.FileUploadException

getRequestURL

public java.lang.String getRequestURL()
Specified by:
getRequestURL in interface CoefficientContext
Overrides:
getRequestURL in class BaseCoefficientContext

setupUser

private void setupUser(org.apache.commons.collections.ExtendedProperties properties)


Copyright CSIR. All Rights Reserved.