org.apache.james.test.functional
Class AbstractSimpleScriptedTestProtocol

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.james.test.functional.AbstractProtocolTestFramework
              extended by org.apache.james.test.functional.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 AbstractProtocolTestFramework.preElements and AbstractProtocolTestFramework.postElements for extra elements not defined in the protocol session file.


Field Summary
 
Fields inherited from class org.apache.james.test.functional.AbstractProtocolTestFramework
postElements, preElements, testElements
 
Constructor Summary
AbstractSimpleScriptedTestProtocol(HostSystem hostSystem, java.lang.String userName, java.lang.String password)
          Sets up a SimpleFileProtocolTest which reads the protocol session from a file of name ".test".
 
Method Summary
protected  void addTestFile(java.lang.String fileName, ProtocolSession 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 AbstractProtocolTestFramework.testElements ProtocolSession.
protected  void tearDown()
           
 
Methods inherited from class org.apache.james.test.functional.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)
Sets up a SimpleFileProtocolTest which reads the protocol session from a file of name ".test". This file should be available in the classloader in the same location as this test class.

Parameters:
fileName - The name of the file to read protocol elements from.
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 AbstractProtocolTestFramework.testElements ProtocolSession. Then calls AbstractProtocolTestFramework.runSessions().

Parameters:
locale - TODO
Throws:
java.lang.Exception

addTestFile

protected void addTestFile(java.lang.String fileName,
                           ProtocolSession 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 © 2002-2008 The Apache Software Foundation. All Rights Reserved.