com.counterclaim.openefm
Class BaseTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bycom.counterclaim.openefm.BaseTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractOpenEFMModelTestCase, BaseLxmlTestCase, HttpContentClientTestCase, InternalLxmlFilingImplTestCase, LxmlFilingImplTestCase, LxmlResponseImplTestCase, ModelExceptionTestCase, ModelFactoryTestCase, ModelObjectImplTestCase, ObjectManagerImplTestCase, ObjectModelImplTestCase, XPathHelperTestCase

public class BaseTestCase
extends junit.framework.TestCase

This is an optional base class for our OpenEFM test cases, providing common methods such as the creation of complex objects which may be needed in more than one test case.

 

Field Summary
(package private) static long IdIndex
           
protected static java.lang.String SAMPLE_LXML_PATH
           
(package private) static OpenEFMServer Server
           
protected static java.lang.String SERVER_CONFIG_PATH
           
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
BaseTestCase(java.lang.String name)
          Construct a TestCase with the given name.
 
Method Summary
static void assertFalse(boolean result)
          Assert that 'result' is false.
static void assertFalse(java.lang.String message, boolean result)
          Assert that 'result' is false.
static void assertNegative(int result)
          Assert that 'result' is negative (and nonzero).
static void assertNegative(java.lang.String message, int result)
          Assert that 'result' is negative (and nonzero).
static void assertPositive(int result)
          Assert that 'result' is greater than zero (nonnegative and nonzero).
static void assertPositive(java.lang.String message, int result)
          Assert that 'result' is greater than zero (nonnegative and nonzero).
static void assertZero(int result)
          Assert that 'result' is zero.
static void assertZero(java.lang.String message, int result)
          Assert that 'result' is zero.
 OpenEFMController getController()
          Return the OzoneEFMController, all initialized and ready for testing.
 FilingContext getFilingContext()
          Return a new FilingContext with username "gollum" and password "precious".
 Id getId()
          Return a unique Id object.
 InternalLxmlFilingImpl getInternalLxmlFiling()
          Return an initialized OzoneLxmlFilingImpl for testing.
 InternalLxmlFilingImpl getInternalLxmlFiling(java.lang.String lxmlFilePath)
          Return an initialized OzoneLxmlFilingImpl for testing.
 OzoneOpenEFMModelImpl getModel()
          Return an OzoneEFMModel, with its controller and other initalization in place.
 OzoneLxmlFilingImpl getOzoneLxmlFiling()
          Return an initialized OzoneLxmlFilingImpl for testing.
 OzoneLxmlFilingManagerImpl getOzoneObjectManager()
          Return an ozone-implemented ObjectManager.
 OzoneUserImpl getOzoneUser()
          Return an initialized OzoneUserImpl for testing.
 InternalLxmlFiling getSampleInternalLxmlFiling()
          Return a valid InternalLxmlFiling, based on the sample XML in .
 LxmlFiling getSampleLxmlFiling()
          Return a valid LxmlFiling, based on the sample XML in .
 OpenEFMServer restartServer()
          Initialize and start a new OpenEFMServer.
 void setUp()
          Perform any initialization common to all my tests.
 OpenEFMServer startServer()
          If the static OpenEFMServer is not already running, initialize and start it.
 void tearDown()
          Clean up any stale data, after all my tests are complete.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, 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

IdIndex

static long IdIndex

Server

static OpenEFMServer Server

SERVER_CONFIG_PATH

protected static final java.lang.String SERVER_CONFIG_PATH
See Also:
Constant Field Values

SAMPLE_LXML_PATH

protected static final java.lang.String SAMPLE_LXML_PATH
See Also:
Constant Field Values
Constructor Detail

BaseTestCase

public BaseTestCase(java.lang.String name)
Construct a TestCase with the given name. Note that this does not obviate the need for such a constructor in the base class.

Parameters:
name - the name of this test case
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Perform any initialization common to all my tests.

Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Clean up any stale data, after all my tests are complete.

Throws:
java.lang.Exception

assertZero

public static void assertZero(int result)
Assert that 'result' is zero.

Parameters:
result - an int which should be zero

assertZero

public static void assertZero(java.lang.String message,
                              int result)
Assert that 'result' is zero.

Parameters:
message - a description for a failed test
result - an int which should be zero

assertPositive

public static void assertPositive(int result)
Assert that 'result' is greater than zero (nonnegative and nonzero).

Parameters:
result - an int which ought to be positive

assertPositive

public static void assertPositive(java.lang.String message,
                                  int result)
Assert that 'result' is greater than zero (nonnegative and nonzero).

Parameters:
message - a description for a failed test
result - an int which ought to be positive

assertNegative

public static void assertNegative(int result)
Assert that 'result' is negative (and nonzero).

Parameters:
result - an int which should be less than zero

assertNegative

public static void assertNegative(java.lang.String message,
                                  int result)
Assert that 'result' is negative (and nonzero).

Parameters:
message - a description for a failed test
result - an int which should be less than zero

assertFalse

public static void assertFalse(boolean result)
Assert that 'result' is false.

Parameters:
result - an int which should be false

assertFalse

public static void assertFalse(java.lang.String message,
                               boolean result)
Assert that 'result' is false.

Parameters:
message - a description for a failed test
result - an int which should be false

startServer

public OpenEFMServer startServer()
                          throws java.io.IOException
If the static OpenEFMServer is not already running, initialize and start it. Call this method any time you need the actual application to be running. It will only start the server once, so if you need to restart it, call 'restartServer()'.

Throws:
java.io.IOException

restartServer

public OpenEFMServer restartServer()
                            throws java.io.IOException,
                                   java.lang.InterruptedException
Initialize and start a new OpenEFMServer. If one is already running, shut that one down first.

Throws:
java.io.IOException
java.lang.InterruptedException

getId

public Id getId()
         throws java.lang.Exception
Return a unique Id object. Note: I could have used class IdFactory for this, but that requires some initialization, and, moreover, not doing so tests whether any old Id will do.

Throws:
java.lang.Exception
Returns:
an Id

getController

public OpenEFMController getController()
                                throws java.lang.Exception
Return the OzoneEFMController, all initialized and ready for testing. HACK: this controller is created out of context, so it use is limited.

Throws:
java.lang.Exception
Returns:
the mighty OpenEFM controller object

getModel

public OzoneOpenEFMModelImpl getModel()
                               throws java.lang.Exception
Return an OzoneEFMModel, with its controller and other initalization in place.

Throws:
java.lang.Exception
Returns:
an OzoneEFMModelImpl

getOzoneObjectManager

public OzoneLxmlFilingManagerImpl getOzoneObjectManager()
                                                 throws java.lang.Exception
Return an ozone-implemented ObjectManager.

Throws:
java.lang.Exception
Returns:
an ObjectManager object

getOzoneLxmlFiling

public OzoneLxmlFilingImpl getOzoneLxmlFiling()
                                       throws java.lang.Exception
Return an initialized OzoneLxmlFilingImpl for testing.

Throws:
java.lang.Exception
Returns:
a ready OzoneLxmlFilingImpl

getInternalLxmlFiling

public InternalLxmlFilingImpl getInternalLxmlFiling()
                                             throws java.lang.Exception
Return an initialized OzoneLxmlFilingImpl for testing.

Throws:
java.lang.Exception
Returns:
a ready OzoneLxmlFilingImpl

getInternalLxmlFiling

public InternalLxmlFilingImpl getInternalLxmlFiling(java.lang.String lxmlFilePath)
                                             throws java.lang.Exception
Return an initialized OzoneLxmlFilingImpl for testing.

Throws:
java.lang.Exception
Returns:
a ready OzoneLxmlFilingImpl

getSampleInternalLxmlFiling

public InternalLxmlFiling getSampleInternalLxmlFiling()
                                               throws java.lang.Exception
Return a valid InternalLxmlFiling, based on the sample XML in ./sample. A new FilingContext is defined containing the login gollum:precious.

Throws:
java.lang.Exception
Returns:
a valid InternalLxmlFiling

getSampleLxmlFiling

public LxmlFiling getSampleLxmlFiling()
                               throws java.lang.Exception
Return a valid LxmlFiling, based on the sample XML in ./sample.

Throws:
java.lang.Exception
Returns:
a valid LxmlFiling

getFilingContext

public FilingContext getFilingContext()
Return a new FilingContext with username "gollum" and password "precious".

Returns:
a new FilingContext

getOzoneUser

public OzoneUserImpl getOzoneUser()
                           throws java.lang.Exception
Return an initialized OzoneUserImpl for testing.

Throws:
java.lang.Exception
Returns:
a ready User object


Copyright © 2002 counterclaim.com. All Rights Reserved.