Package com.verisign.epp.pool
Class EPPSessionPoolTst
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- com.verisign.epp.pool.EPPSessionPoolTst
-
- All Implemented Interfaces:
junit.framework.Test
- Direct Known Subclasses:
EPPSystemSessionPoolTst
public class EPPSessionPoolTst extends junit.framework.TestCase
-
-
Field Summary
Fields Modifier and Type Field Description protected static EPPApplicationSingle
app
Handle to the Singleton EPP Application instance (EPPApplicationSingle
)protected static java.lang.String
configFileName
Name of configuration file to use for test (default = epp.config).protected static EPPSessionPool
sessionPool
EPP Session pool associated with test
-
Constructor Summary
Constructors Constructor Description EPPSessionPoolTst(java.lang.String name)
Allocates anEPPSessionPoolTst
with a logical name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected EPPSession
borrowSession()
Utility method to borrow a session from the session pool.protected void
invalidateSession(EPPSession aSession)
Utility method to invalidate a session in the session pool.static void
main(java.lang.String[] args)
Unit test main, which accepts the following system property options:
iterations Number of unit test iterations to run validate Turn XML validation on (true
) or off (false
).static void
printEnd(java.lang.String aTest)
Print the end of a test with theThread
name if the current thread is aTestThread
.static void
printStart(java.lang.String aTest)
Print the start of a test with theThread
name if the current thread is aTestThread
.protected void
returnSession(EPPSession aSession)
Utility method to return a session to the session pool.protected void
setUp()
JUNITsetUp
methodstatic junit.framework.Test
suite()
JUNITsuite
static method, which returns the tests associated withEPPSessionPoolTst
.protected void
tearDown()
JUNITtearDown
, which currently does nothing.void
testAbsoluteTimeout()
Print out the number of active and idle sessions prior to sleeping for 1 second past the absolute timeout, which should result in the sessions getting refreshed.void
testCloseSession()
Test the handling of a session that is closed by the server by sending a poll aock with the message ID "CLOSE-SESSION-TEST".void
testEndSession()
Unit test ofEPPSession.endSession
.void
testHello()
Unit test ofEPPSession.sendHello
command.void
testIdleTimeout()
Test that the idle timeout is working by sleeping for 1 second past the idle timeout.void
testPoll()
Unit test ofEPPSession.sendPoll
command.-
Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
-
-
-
-
Field Detail
-
app
protected static EPPApplicationSingle app
Handle to the Singleton EPP Application instance (EPPApplicationSingle
)
-
configFileName
protected static java.lang.String configFileName
Name of configuration file to use for test (default = epp.config).
-
sessionPool
protected static EPPSessionPool sessionPool
EPP Session pool associated with test
-
-
Method Detail
-
testHello
public void testHello()
Unit test ofEPPSession.sendHello
command. The session attribute is initialized with the attributes defined in the EPP sample files.
-
testPoll
public void testPoll()
Unit test ofEPPSession.sendPoll
command.
-
testCloseSession
public void testCloseSession()
Test the handling of a session that is closed by the server by sending a poll aock with the message ID "CLOSE-SESSION-TEST". This test will only work against the Stub Server.
-
testEndSession
public void testEndSession()
Unit test ofEPPSession.endSession
. One session in the session pool wil be ended.
-
testAbsoluteTimeout
public void testAbsoluteTimeout()
Print out the number of active and idle sessions prior to sleeping for 1 second past the absolute timeout, which should result in the sessions getting refreshed. Look to the logs to ensure that the sessions were refreshed since there is no API to ensure that the sessions were refreshed. The test does nothing if the absolute timeout is set to a value higher than 10000 (10 seconds) since the Production configuration would result in the test sleeping for 1 day.
-
testIdleTimeout
public void testIdleTimeout()
Test that the idle timeout is working by sleeping for 1 second past the idle timeout. There a log message containing the text "is past idle timeout", sending "hello"for each idle session in the pool in "epp.log". This test will only run if the idle timeout is lower than or equal to 10 seconds.
-
setUp
protected void setUp()
JUNITsetUp
method- Overrides:
setUp
in classjunit.framework.TestCase
-
tearDown
protected void tearDown()
JUNITtearDown
, which currently does nothing.- Overrides:
tearDown
in classjunit.framework.TestCase
-
suite
public static junit.framework.Test suite()
JUNITsuite
static method, which returns the tests associated withEPPSessionPoolTst
.- Returns:
- Tests to run
-
main
public static void main(java.lang.String[] args)
Unit test main, which accepts the following system property options:
- iterations Number of unit test iterations to run
- validate Turn XML validation on (
true
) or off (false
). If validate is not specified, validation will be off.
- Parameters:
args
- Program arguments
-
printStart
public static void printStart(java.lang.String aTest)
Print the start of a test with theThread
name if the current thread is aTestThread
.- Parameters:
aTest
- name for the test
-
printEnd
public static void printEnd(java.lang.String aTest)
Print the end of a test with theThread
name if the current thread is aTestThread
.- Parameters:
aTest
- name for the test
-
borrowSession
protected EPPSession borrowSession()
Utility method to borrow a session from the session pool. All exceptions will result in the test failing. This method should only be used for positive session pool tests.- Returns:
- Session from the session pool
-
invalidateSession
protected void invalidateSession(EPPSession aSession)
Utility method to invalidate a session in the session pool.- Parameters:
aSession
- Session to invalidate in the pool
-
returnSession
protected void returnSession(EPPSession aSession)
Utility method to return a session to the session pool. This should be placed in a finally block. All exceptions will result in the test failing.- Parameters:
aSession
- Session to return to the pool
-
-