|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.infoglue.cms.util.InfoGlueTestCase
org.infoglue.cms.util.WorkflowTestCase
public abstract class WorkflowTestCase
Base class for workflow tests. Uses the "Create News" sample workflow. We don't do the "Preview news and approve" step because we don't want to deal with saving content that we have to clean up later. Going through the first step should suffice to demonstrate that the right things are happening as far as the workflow is concerned. It is easy enough to hook up "Preview news and approve" if it turns out that testing the step is worth the headache of figuring out which content to remove when the test finishes.
| Field Summary | |
|---|---|
static int |
FINISH_WORKFLOW
The ID of the global action "Finish Workflow". |
| Constructor Summary | |
|---|---|
WorkflowTestCase()
|
|
| Method Summary | |
|---|---|
protected void |
assertWorkflowFinished()
Asserts the the current workflow is finished by verifying that no workflow with workflowId is in the list of current workflows. |
protected void |
checkActions(int expectedSize,
java.util.List actions)
Verifies that each action in the list has at least a couple of critical properties defined |
protected void |
checkWorkflow(int currentSteps,
int historySteps,
int availableActions)
Verifies that workflow is what we expect |
protected WorkflowVO |
findCurrentWorkflow()
Finds the current workflow that matches workflowId |
protected WorkflowVO |
findWorkflow(java.util.List workflows)
Finds the workflow in the given list that matches workflowId. |
protected WorkflowVO |
findWorkflowByName(java.util.List workflows)
Finds the workflow in the given list that matches the name of the workflow under test |
protected void |
finishWorkflow()
Invokes the "Finish Workflow" action. |
protected int |
getNumberOfGlobalActions()
Returns the number of global actions. |
protected int |
getNumberOfInitialActions()
Returns the number of initial actions. |
protected com.opensymphony.module.propertyset.PropertySet |
getPropertySet()
|
protected InfoGluePrincipal |
getUserPrincipal()
|
protected WorkflowVO |
getWorkflow()
|
protected long |
getWorkflowId()
|
protected abstract java.lang.String |
getWorkflowName()
Subclasses must supply the workflow name |
protected void |
invokeAction(javax.servlet.http.HttpServletRequest request,
int actionId)
Invokes a workflow action |
protected static void |
printActions(java.util.List actions)
Prints the given list of actions to stdout |
protected static void |
printAvailableActions(WorkflowVO workflow)
Prints all available actions for the give workflow to stdout |
protected static void |
printSteps(java.util.List steps)
Prints a list of steps to stdout |
protected static void |
printWorkflows(java.util.List workflows)
Prints the workflows in the list to stdout. |
protected void |
setUserPrincipal(InfoGluePrincipal userPrincipal)
|
protected void |
setWorkflow(WorkflowVO workflow)
|
protected void |
startWorkflow(int initialAction)
Starts the workflow by creating a new workflow instance and assigning it to workflow |
| Methods inherited from class org.infoglue.cms.util.InfoGlueTestCase |
|---|
changeDate, changeDate, createRole, getAdminPrincipal, getAnonPrincipal, getCmsUserPrincipal, getLanguageId, getLanguageId, getRepoId, getSiteNodeId, getSiteNodeId, initializeInfoGlue, setUp |
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int FINISH_WORKFLOW
| Constructor Detail |
|---|
public WorkflowTestCase()
| Method Detail |
|---|
protected abstract java.lang.String getWorkflowName()
protected int getNumberOfInitialActions()
protected int getNumberOfGlobalActions()
protected WorkflowVO getWorkflow()
protected void setWorkflow(WorkflowVO workflow)
protected long getWorkflowId()
protected com.opensymphony.module.propertyset.PropertySet getPropertySet()
protected InfoGluePrincipal getUserPrincipal()
protected void setUserPrincipal(InfoGluePrincipal userPrincipal)
protected void startWorkflow(int initialAction)
throws java.lang.Exception
java.lang.ExceptionsetWorkflow(org.infoglue.cms.entities.mydesktop.WorkflowVO)
protected void finishWorkflow()
throws java.lang.Exception
java.lang.Exception - if an error occurs
protected void invokeAction(javax.servlet.http.HttpServletRequest request,
int actionId)
throws java.lang.Exception
request - the HTTP request (or simulation thereof)actionId - the ID of the desired workflow action
java.lang.Exception - if an error occurs
protected void checkWorkflow(int currentSteps,
int historySteps,
int availableActions)
currentSteps - the expected number of current stepshistorySteps - the expected number of history stepsavailableActions - the expected number of available actions
protected void checkActions(int expectedSize,
java.util.List actions)
expectedSize - the expected size of the listactions - a list of WorkflowActionVOs
protected void assertWorkflowFinished()
throws java.lang.Exception
java.lang.Exception - if an error occurs.
protected WorkflowVO findCurrentWorkflow()
throws java.lang.Exception
java.lang.Exception - if an error occursprotected WorkflowVO findWorkflow(java.util.List workflows)
workflows - a list of WorkflowVOs
protected WorkflowVO findWorkflowByName(java.util.List workflows)
workflows - a list of WorkflowVOs
protected static void printWorkflows(java.util.List workflows)
workflows - a list of WorkflowVOsprotected static void printSteps(java.util.List steps)
steps - a list of WorkflowStepVOs to printprotected static void printAvailableActions(WorkflowVO workflow)
workflow - the workflow whoise actions will be printedprotected static void printActions(java.util.List actions)
actions - a list of WorkflowActionVOs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||