org.exolab.jmscts.core
Class TestContext

java.lang.Object
  |
  +--org.exolab.jmscts.core.TestContext

public final class TestContext
extends java.lang.Object

Instances of this class maintain the context of the current test case.

Version:
$Revision: 1.7 $ $Date: 2004/01/31 13:44:24 $
Author:
Tim Anderson
See Also:
JMSTestCase, JMSTestRunner, ProviderTestRunner, ConnectionTestRunner, SessionTestRunner, MessageTestRunner, SendReceiveTestRunner, TestCoverage

Constructor Summary
TestContext(TestContext parent, Administrator administrator)
          Construct an administrator context.
TestContext(TestContext parent, java.lang.Class messageType)
          Construct a message context.
TestContext(TestContext parent, java.lang.Class messageType, MessagingBehaviour behaviour)
          Construct a send/receive context.
TestContext(TestContext parent, javax.jms.Connection connection)
          Construct a connection context.
TestContext(TestContext parent, javax.jms.ConnectionFactory factory, java.lang.Class type)
          Construct a connection factory context.
TestContext(TestContext parent, javax.jms.Message message)
          Construct a message context.
TestContext(TestContext parent, javax.jms.Message message, MessagingBehaviour behaviour)
          Construct a send/receive context.
TestContext(TestContext parent, javax.jms.Session session, AckType type)
          Construct a session context.
TestContext(TestCoverage coverage)
          Construct a requirements test root context
TestContext(TestStatistics statistics)
          Construct a stress test root context
 
Method Summary
 void close()
          Close this context
 AckType getAckType()
          Returns the current session's message acknowledgement type
 Administrator getAdministrator()
          Returns the JMS provider's administration interface
 javax.jms.Connection getConnection()
          Returns the current connection
 javax.jms.ConnectionFactory getConnectionFactory()
          Returns the current connection factory
 java.lang.Class getConnectionFactoryType()
          Returns the connection factory type
 java.lang.Class getConnectionType()
          Returns the current connection type
 TestCoverage getCoverage()
          Returns the test coverage of requirements
 javax.jms.Message getMessage()
          Returns the current message
 java.lang.Class getMessageType()
          Returns the current message type
 MessagingBehaviour getMessagingBehaviour()
          Returns the current messaging behaviour
 TestContext getParent()
          Returns the parent context
 javax.jms.Session getSession()
          Returns the current session
 java.lang.Class getSessionType()
          Returns the current session type
 TestStatistics getStatistics()
          Returns the test statistics
 void invalidate()
          Invalidate the connection and/or session managed by this context
 boolean isInvalid()
          Determines if this context is invalid
 boolean isQueue()
          Determines if the context is a queue context, i.e., point-to-point
 boolean isQueueConnectionFactory()
          Determines if the connection factory is a QueueConnectionFactory
 boolean isTopic()
          Determines if the context is a topic context, i.e., publish-and-subscribe
 boolean isTopicConnectionFactory()
          Determines if the connection factory is a TopicConnectionFactory
 boolean isXAQueueConnectionFactory()
          Determines if the connection factory is an XAQueueConnectionFactory
 boolean isXATopicConnectionFactory()
          Determines if the connection factory is an XATopicConnectionFactory
 java.lang.String toString()
          Returns a string representation of the context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestContext

public TestContext(TestCoverage coverage)
Construct a requirements test root context
Parameters:
coverage - the test coverage of requirements

TestContext

public TestContext(TestStatistics statistics)
Construct a stress test root context
Parameters:
statistics - the stress test statistics

TestContext

public TestContext(TestContext parent,
                   Administrator administrator)
Construct an administrator context. The parent must be a root context.
Parameters:
parent - a root context
administrator - the JMS provider administration interface

TestContext

public TestContext(TestContext parent,
                   javax.jms.ConnectionFactory factory,
                   java.lang.Class type)
Construct a connection factory context. The parent context must be an administrator context.
Parameters:
parent - an administrator context
factory - the connection factory
type - the connection factory interface class. This is required to identify the connection factory implementation as some vendors (eg. Sun) implement queue and topic connection factories using the same class, but fail to create connections if the factory was intended to create a different connection type.

TestContext

public TestContext(TestContext parent,
                   javax.jms.Connection connection)
Construct a connection context. The parent context must be a connection factory context.
Parameters:
parent - a connection factory context
connection - the connection

TestContext

public TestContext(TestContext parent,
                   javax.jms.Session session,
                   AckType type)
Construct a session context. The parent context must be a connection context.
Parameters:
parent - a connection context
session - the session
type - the message acknowledgement type of the session

TestContext

public TestContext(TestContext parent,
                   java.lang.Class messageType)
Construct a message context. The parent context must be a session context.
Parameters:
parent - a session context
messageType - the message type

TestContext

public TestContext(TestContext parent,
                   javax.jms.Message message)
Construct a message context. The parent context must be a session context.
Parameters:
parent - a session context
message - the message

TestContext

public TestContext(TestContext parent,
                   java.lang.Class messageType,
                   MessagingBehaviour behaviour)
Construct a send/receive context. The parent context must be a session context.
Parameters:
parent - a session context
messageType - the message type
behaviour - the messaging behaviour

TestContext

public TestContext(TestContext parent,
                   javax.jms.Message message,
                   MessagingBehaviour behaviour)
Construct a send/receive context. The parent context must be a session context.
Parameters:
parent - a session context
message - the message
behaviour - the messaging behaviour
Method Detail

getCoverage

public TestCoverage getCoverage()
Returns the test coverage of requirements
Returns:
the test coverage of requirements

getStatistics

public TestStatistics getStatistics()
Returns the test statistics
Returns:
the test statistics

getAdministrator

public Administrator getAdministrator()
Returns the JMS provider's administration interface
Returns:
the administration interface

getConnectionFactory

public javax.jms.ConnectionFactory getConnectionFactory()
Returns the current connection factory
Returns:
the current connection factory

getConnectionFactoryType

public java.lang.Class getConnectionFactoryType()
Returns the connection factory type
Returns:
the connection factory type

isQueueConnectionFactory

public boolean isQueueConnectionFactory()
Determines if the connection factory is a QueueConnectionFactory
Returns:
true if the connection factory is a QueueConnectionFactory

isTopicConnectionFactory

public boolean isTopicConnectionFactory()
Determines if the connection factory is a TopicConnectionFactory
Returns:
true if the connection factory is a TopicConnectionFactory

isXAQueueConnectionFactory

public boolean isXAQueueConnectionFactory()
Determines if the connection factory is an XAQueueConnectionFactory
Returns:
true if the connection factory is an XAQueueConnectionFactory

isXATopicConnectionFactory

public boolean isXATopicConnectionFactory()
Determines if the connection factory is an XATopicConnectionFactory
Returns:
true if the connection factory is an XATopicConnectionFactory

isQueue

public boolean isQueue()
Determines if the context is a queue context, i.e., point-to-point
Returns:
true if this is a topic context

isTopic

public boolean isTopic()
Determines if the context is a topic context, i.e., publish-and-subscribe
Returns:
true if this is a topic context

getConnection

public javax.jms.Connection getConnection()
Returns the current connection
Returns:
the current connection, or null, if this not a child of a connection factory context

getConnectionType

public java.lang.Class getConnectionType()
Returns the current connection type
Returns:
the current connection type, or null, if this not a child of a connection factory context

getSession

public javax.jms.Session getSession()
Returns the current session
Returns:
the current session, or null, if this not a child of a connection context

getSessionType

public java.lang.Class getSessionType()
Returns the current session type
Returns:
the current session type, or null, if this not a child of a connection context

getAckType

public AckType getAckType()
Returns the current session's message acknowledgement type
Returns:
the message acknowledgement type of the session, or null, if this is not a child of a connection context

getMessage

public javax.jms.Message getMessage()
Returns the current message
Returns:
the current message, or null, if this not a child of a message context

getMessageType

public java.lang.Class getMessageType()
Returns the current message type
Returns:
the current message type, or null, if this not a child of a message context

getMessagingBehaviour

public MessagingBehaviour getMessagingBehaviour()
Returns the current messaging behaviour
Returns:
the current messaging behaviour, or null, if this not a child of a send/receive context

invalidate

public void invalidate()
Invalidate the connection and/or session managed by this context

isInvalid

public boolean isInvalid()
Determines if this context is invalid
Returns:
true if this context is invalid

getParent

public TestContext getParent()
Returns the parent context
Returns:
the parent context, or null if there is no parent context

close

public void close()
           throws javax.jms.JMSException
Close this context
Throws:
javax.jms.JMSException - if a JMS error is encountered

toString

public java.lang.String toString()
Returns a string representation of the context
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the context


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.