org.apache.james.test.functional
Class AbstractProtocolTestFramework

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.james.test.functional.AbstractProtocolTestFramework
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractSimpleScriptedTestProtocol

public abstract class AbstractProtocolTestFramework
extends junit.framework.TestCase

Abstract Protocol Test is the root of all of the James Imap Server test cases. It provides basic functionality for running a protocol session as a JUnit test, and failing if exceptions are thrown. To create a test which reads the entire protocol session from a single protocol definition file, use the AbstractSimpleScriptedTestProtocol.

Author:
Darrell DeBoer, Andrew C. Oliver

Field Summary
protected  ProtocolSession postElements
          The Protocol session which is run after the testElements.
protected  ProtocolSession preElements
          The Protocol session which is run before the testElements
protected  ProtocolSession testElements
          The Protocol session which contains the tests elements
 
Constructor Summary
AbstractProtocolTestFramework(HostSystem hostSystem, java.lang.String userName, java.lang.String password)
           
 
Method Summary
protected  void continueAfterFailure()
           
protected  void runSessions()
          Runs the pre,test and post protocol sessions against a local copy of the ImapServer.
protected  void 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

preElements

protected ProtocolSession preElements
The Protocol session which is run before the testElements


testElements

protected ProtocolSession testElements
The Protocol session which contains the tests elements


postElements

protected ProtocolSession postElements
The Protocol session which is run after the testElements.

Constructor Detail

AbstractProtocolTestFramework

public AbstractProtocolTestFramework(HostSystem hostSystem,
                                     java.lang.String userName,
                                     java.lang.String password)
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

continueAfterFailure

protected void continueAfterFailure()

runSessions

protected void runSessions()
                    throws java.lang.Exception
Runs the pre,test and post protocol sessions against a local copy of the ImapServer. This does not require that James be running, and is useful for rapid development and debugging. Instead of sending requests to a socket connected to a running instance of James, this method uses the MockImapServer to simplify testing. One mock instance is required per protocol session/connection. These share the same underlying Mailboxes, because of the way MockImapServer#getImapSession() works.

Throws:
java.lang.Exception


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.