org.apache.james.mpt
Class AbstractSimpleScriptedTestProtocol

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.james.mpt.AbstractProtocolTestFramework
              extended by org.apache.james.mpt.AbstractSimpleScriptedTestProtocol
All Implemented Interfaces:
junit.framework.Test

public abstract class AbstractSimpleScriptedTestProtocol
extends AbstractProtocolTestFramework

A Protocol test which reads the test protocol session from a file. The file read is taken as ".test", where is the value passed into the constructor. Subclasses of this test can set up pre- and post elements for extra elements not defined in the protocol session file.


Field Summary
 
Fields inherited from class org.apache.james.mpt.AbstractProtocolTestFramework
runner
 
Constructor Summary
AbstractSimpleScriptedTestProtocol(HostSystem hostSystem, java.lang.String userName, java.lang.String password)
          Constructs a scripted test.
 
Method Summary
protected  void addTestFile(java.lang.String fileName, ProtocolInteractor session)
          Finds the protocol session file identified by the test name, and builds protocol elements from it.
protected  void scriptTest(java.lang.String fileName, java.util.Locale locale)
          Reads test elements from the protocol session file and adds them to the ProtocolSession.
protected  void tearDown()
           
 
Methods inherited from class org.apache.james.mpt.AbstractProtocolTestFramework
continueAfterFailure, runSessions, setUp
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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
 

Constructor Detail

AbstractSimpleScriptedTestProtocol

public AbstractSimpleScriptedTestProtocol(HostSystem hostSystem,
                                          java.lang.String userName,
                                          java.lang.String password)
Constructs a scripted test.

Parameters:
hostSystem - not null
userName - user name
password - password for user
Method Detail

tearDown

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

scriptTest

protected void scriptTest(java.lang.String fileName,
                          java.util.Locale locale)
                   throws java.lang.Exception
Reads test elements from the protocol session file and adds them to the ProtocolSession. Then calls AbstractProtocolTestFramework.runSessions().

Parameters:
locale - test under this default locale, not null
Throws:
java.lang.Exception

addTestFile

protected void addTestFile(java.lang.String fileName,
                           ProtocolInteractor session)
                    throws java.lang.Exception
Finds the protocol session file identified by the test name, and builds protocol elements from it. All elements from the definition file are added to the supplied ProtocolSession.

Parameters:
fileName - The name of the file to read
session - The ProtocolSession to add elements to.
Throws:
java.lang.Exception


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