org.jboss.test
Class JBossTestCase

java.lang.Object
  extended byTestCase
      extended byorg.jboss.test.JBossTestCase
Direct Known Subclasses:
AbsoluteImportTestCase (src) , AddressRewriteTestCase (src) , AdminObjectUnitTestCase (src) , AOPUnitTestCase (src) , AppClientUnitTestCase (src) , AttachmentDIITestCase (src) , AttachmentSAAJTestCase (src) , AttributesUnitTestCase (src) , AuditUnitTestCase (src) , BankEJB20StressTestCase (src) , BankMarathonTestCase (src) , BankStressTestCase (src) , BankStressTestCase (src) , BaseConnectionManagerStressTestCase (src) , BasicMessageDrivenUnitTest (src) , BasicTimerUnitTestCase (src) , BeanProxyUnitTestCase (src) , BeanStressTestCase (src) , BeanStressTestCase (src) , BeanUnitTestCase (src) , BmpUnitTestCase (src) , BmpUnitTestCase (src) , CachedConnectionBankStressTestCase (src) , CachedConnectionSessionUnitTestCase (src) , CacheInvalidationUnitTestCase (src) , CacheObjectMBeanUnitTestCase (src) , CallerInfoUnitTestCase (src) , CircularityUnitTestCase (src) , ClasspathExtensionUnitTestCase (src) , CleanTopicRemovalUnitTestCase (src) , Client (src) , ClientSideEJBTestCase (src) , ClientSideJSETestCase (src) , CmpUnitTestCase (src) , CMRPostCreatesWrittenUnitTestCase (src) , CMRStressTestCase (src) , CMRTransactionUnitTestCase (src) , CompleteUnitTestCase (src) , ConcurrentDeliveryUnitTestCase (src) , ConnectionFactorySerializationUnitTestCase (src) , CPManifestUnitTestCase (src) , CtsCmp2UnitTestCase (src) , CustomSocketsUnitTestCase (src) , DbTypesUnitTestCase (src) , DeploymentServiceUnitTestCase (src) , DeploymentTestCase (src) , DeploymentUnitTestCase (src) , DeployServiceUnitTestCase (src) , DeployXMBeanUnitTestCase (src) , DestinationFullUnitTestCase (src) , DuplicateClientIDUnitTestCase (src) , DynLoadingUnitTestCase (src) , EarDeploymentUnitTestCase (src) , EjbLinkUnitTestCase (src) , EJBLoadUnitTestCase (src) , EJBSpecUnitTestCase (src) , EJBSpecUnitTestCase (src) , ENCUnitTestCase (src) , EnterpriseEntityStressTestCase (src) , EnterpriseEntityTest (src) , EntityBeanTestCase (src) , EntityExcUnitTestCase (src) , EntityPassivationUnitTestCase (src) , EntityUnitTestCase (src) , ExampleTestCase (src) , ExceptionTimingStressTestCase (src) , ExternalContextUnitTestCase (src) , FKStackOverflowUnitTestCase (src) , FormAuthUnitTestCase (src) , HAConnectionFactoryUnitTestCase (src) , HAInvokerUnitTestCase (src) , HelloCachedUnitTestCase (src) , HelloClusteredHttpStressTestCase (src) , HelloHttpStressTestCase (src) , HelloTimingStressTestCase (src) , HelloTimingStressTestCase (src) , HelloTimingStressTestCase (src) , HibernateIntgUnitTestCase (src) , HTTPConnectionUnitTestCase (src) , HttpsUnitTestCase (src) , IdGenUnitTestCase (src) , IIOPUserTransactionStressTestCase (src) , IndependentJarsUnitTestCase (src) , InflowUnitTestCase (src) , InvocationLayerStressTest (src) , IsolationUnitTestCase (src) , JaasSecurityDomainUnitTestCase (src) , JaasUnitTestCase (src) , JarInSarJSR77UnitTestCase (src) , JBAS897TestCase (src) , JBossClusteredTestCase (src) , JBossMQPerfStressTestCase (src) , JBossMQReconnectStressTestCase (src) , JBossMQUnitTest (src) , JBossNetTestBase (src) , JBossSessionRecoverUnitTestCase (src) , JBWS64TestCase (src) , JDBCDriverRedeployUnitTestCase (src) , JDBCStatementTestsConnectionUnitTestCase (src) , JMXConsoleUnitTestCase (src) , JMXInvokerProxyUnitTestCase (src) , JMXInvokerUnitTestCase (src) , JSFIntegrationUnitTestCase (src) , JSR77SpecUnitTestCase (src) , LargeMessageUnitTestCase (src) , LocalEjbTestCase (src) , LocalUnitAopTest (src) , LocalWrapperCleanupUnitTestCase (src) , LoginModulesUnitTestCase (src) , LongWaitStatefulSessionUnitTestCase (src) , M2MBConversionTestCase (src) , MBeanDependsOnConnectionManagerUnitTestCase (src) , MBeanDependsOnEJBUnitTestCase (src) , MBeanUnitTestCase (src) , MBeanUnitTestCase (src) , MDBUnitTestCase (src) , MDBUnitTestCase (src) , MessageBodyUnitTestCase (src) , MessageConversionTestCase (src) , MetaDataUnitTestCase (src) , MQBase (src) , MultiInvokersUnitTestCase (src) , NamingStressTestCase (src) , NoInternalJBossUnitTestCase (src) , O2MBConversionTestCase (src) , ObservableUnitTestCase (src) , OptimisticLockUnitTestCase (src) , ParameterPassingStressTestCase (src) , PathologicalUnitTestCase (src) , PerfStressTestCase (src) , PerfUnitTestCase (src) , PerfUnitTestCase (src) , PersistenceTestCase (src) , PolicyUnitTestCase (src) , PooledInvokerUnitTestCase (src) , PropertyEditorsUnitTestCase (src) , ProtocolHandlerUnitTestCase (src) , ProxyUnitTestCase (src) , PSCacheUnitTestCase (src) , QLConversionTestCase (src) , RaJMSSessionUnitTestCase (src) , RaSyncRecUnitTestCase (src) , RaTest (src) , ReadAheadUnitTestCase (src) , ReadOnlyUnitTestCase (src) , ReentrantUnitTestCase (src) , RelationshipUnitTestCase (src) , RemoteDSUnitTestCase (src) , RemotingUnitTestCase (src) , RetryUnitTestCase (src) , RollbackOnlyReleaseConnectionUnitTestCase (src) , RollBackUnitTestCase (src) , SchedulerUnitTestCase (src) , SchemaImportTestCase (src) , ScopedTransactionUnitTestCase (src) , ScopingUnitTestCase (src) , SecureRMIAdaptorUnitTestCase (src) , SecureTimerUnitTestCase (src) , SecurityContextUnitTestCase (src) , SecurityProxyUnitTestCase (src) , SecurityUnitTestCase (src) , SecurityUnitTestCase (src) , SecurityUnitTestCase (src) , SendReplyPerfStressTestCase (src) , ServerSideEJBTestCase (src) , ServerSideJMSTestCase (src) , ServerSideJSETestCase (src) , ServiceNameTestCase (src) , ServiceRsrcsUnitTestCase (src) , SimpleBeanUnitTestCase (src) , SimpleConversionTestCase (src) , SimpleEJBTestCase (src) , SimpleJSETestCase (src) , SimpleUnitTestCase (src) , SingleSignOnUnitTestCase (src) , SpinUnitTestCase (src) , SRPLoginModuleUnitTestCase (src) , SRPUnitTestCase (src) , SSLFailuresSocketsUnitTestCase (src) , SSLSocketsUnitTestCase (src) , SSLUnitTestCase (src) , StatefulSessionLocalUnitTestCase (src) , StatefulSessionUnitTestCase (src) , StatelessSessionStressTestCase (src) , StatelessSessionUnitTestCase (src) , StringsUnitTestCase (src) , T0PassBasicTypesTestCase (src) , T1PassStringsTestCase (src) , T2PassRemoteRefTestCase (src) , T3PassSerializableTestCase (src) , T4PassIntArraysTestCase (src) , T5PassStringArraysTestCase (src) , T6PassArraysOfSerializablesTestCase (src) , T7PassCollectionsTestCase (src) , T8PassMapsTestCase (src) , T9PassExceptionTestCase (src) , TemporarySessionConnectionUnitTestCase (src) , TestCase (src) , TestCase (src) , TimerUnitTestCase (src) , TransactionManagerUnitTestCase (src) , TxInflowUnitTestCase (src) , TxLockUnitTestCase (src) , TxPropIIOPUnitTestCase (src) , TxTimeoutUnitTestCase (src) , TxUnitTestCase (src) , UIL2ConnectionUnitTestCase (src) , UnackedUnitTestCase (src) , UndeployBrokenPackageUnitTestCase (src) , UnifiedLoaderUnitTestCase (src) , UnpackedDeploymentUnitTestCase (src) , UnsharedConnectionUnitTestCase (src) , UserTransactionLookupTestCase (src) , UserTxUnitTestCase (src) , VersionedObjectUnitTestCase (src) , WebConstraintsUnitTestCase (src) , WebIntegrationUnitTestCase (src) , WebIsolationUnitTestCase (src) , WebserviceTestBase (src) , WorkManagerUnitTestCase (src) , XADSUnitTestCase (src) , XAExceptionUnitTestCase (src) , XAResourceUnitTestCase (src) , XATxConnectionManagerUnitTestCase (src) , XAUnitTestCase (src)

public class JBossTestCase
extends TestCase

This is the standard base test case for jboss junit test cases. It supplies access to log4j logging, the jboss jmx server, jndi, and a method for deploying ejb packages. You may supply the name of the machine the jboss server is on with the system property jbosstest.server.name (default getInetAddress().getLocalHost().getHostName()) and the directory for deployable packages with the system property jbosstest.deploy.dir (default ../lib).

See Also:
Serialized Form

Field Summary
protected  JBossTestServices (src) delegate
           
protected static java.lang.Exception deploymentException
          Saved exception from deployment.
protected  Logger log
           
 
Constructor Summary
JBossTestCase(java.lang.String name)
          Constructor for the JBossTestCase object
 
Method Summary
protected  void deploy(java.lang.String name)
          Deploy a package with the main deployer.
protected  void flushAuthCache()
           
protected  void flushAuthCache(java.lang.String domain)
           
protected  int getBeanCount()
           
protected  ObjectName (src) getDeployerName()
          Gets the DeployerName attribute of the JBossTestCase object
static Test getDeploySetup(Test test, java.lang.String jarNames)
          Get a JBossTestSetup that does login and deployment in setUp/tearDown
protected  java.lang.String getDeployURL(java.lang.String filename)
          Returns the deployment directory to use.
protected  javax.naming.InitialContext getInitialContext()
          Gets the InitialContext attribute of the JBossTestCase object
protected  int getIterationCount()
           
protected  java.lang.String getJndiInitFactory()
           
protected  java.lang.String getJndiURL()
           
protected  Logger getLog()
          Gets the Log attribute of the JBossTestCase object
protected  java.lang.String getResourceURL(java.lang.String resource)
          Get a URL string to a resource in the testsuite/output/resources dir.
protected  RMIAdaptor (src) getServer()
          Gets the Server attribute of the JBossTestCase object
 java.lang.String getServerHost()
          Get the JBoss server host from system property "jbosstest.host.name" This defaults to "localhost"
protected  int getThreadCount()
           
 void initDelegate()
           
protected  java.lang.Object invoke(ObjectName (src)  name, java.lang.String method, java.lang.Object[] args, java.lang.String[] sig)
          invoke wraps an invoke call to the mbean server in a lot of exception unwrapping.
protected  void restartDBPool()
          Restart the connection pool associated with the DefaultDS
protected  void sleep(long interval)
           
 void testServerFound()
          This just checks the server is there...
protected  void undeploy(java.lang.String name)
          Undeploy a package with the main deployer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected Logger log

deploymentException

protected static java.lang.Exception deploymentException
Saved exception from deployment. Will be thrown from testServerFound(), if not null.


delegate

protected JBossTestServices (src)  delegate
Constructor Detail

JBossTestCase

public JBossTestCase(java.lang.String name)
Constructor for the JBossTestCase object

Parameters:
name - Test case name
Method Detail

initDelegate

public void initDelegate()

testServerFound

public void testServerFound()
                     throws java.lang.Exception
This just checks the server is there... so you should get at least one success! Also checks if an exception occurred during deployment, and throws any such exception from here.

Throws:
java.lang.Exception - Description of Exception

getInitialContext

protected javax.naming.InitialContext getInitialContext()
                                                 throws java.lang.Exception
Gets the InitialContext attribute of the JBossTestCase object

Returns:
The InitialContext value
Throws:
java.lang.Exception

getServer

protected RMIAdaptor (src)  getServer()
                        throws java.lang.Exception
Gets the Server attribute of the JBossTestCase object

Returns:
The Server value
Throws:
java.lang.Exception

getLog

protected Logger getLog()
Gets the Log attribute of the JBossTestCase object

Returns:
The Log value

getDeployerName

protected ObjectName (src)  getDeployerName()
                              throws MalformedObjectNameException (src) 
Gets the DeployerName attribute of the JBossTestCase object

Returns:
The DeployerName value
Throws:
MalformedObjectNameException (src) - Description of Exception

getDeployURL

protected java.lang.String getDeployURL(java.lang.String filename)
                                 throws java.net.MalformedURLException
Returns the deployment directory to use. This does it's best to figure out where you are looking. If you supply a complete url, it returns it. Otherwise, it looks for jbosstest.deploy.dir or if missing ../lib. Then it tries to construct a file url or a url.

Parameters:
filename - name of the file/url you want
Returns:
A more or less canonical string for the url.
Throws:
java.net.MalformedURLException - Description of Exception

getResourceURL

protected java.lang.String getResourceURL(java.lang.String resource)
                                   throws java.net.MalformedURLException
Get a URL string to a resource in the testsuite/output/resources dir. This relies on the output/resources directory being in the testcase classpath.

Throws:
java.net.MalformedURLException

invoke

protected java.lang.Object invoke(ObjectName (src)  name,
                                  java.lang.String method,
                                  java.lang.Object[] args,
                                  java.lang.String[] sig)
                           throws java.lang.Exception
invoke wraps an invoke call to the mbean server in a lot of exception unwrapping.

Parameters:
name - ObjectName of the mbean to be called
method - mbean method to be called
args - Object[] of arguments for the mbean method.
sig - String[] of types for the mbean methods parameters.
Returns:
Object returned by mbean method invocation.
Throws:
java.lang.Exception - Description of Exception

deploy

protected void deploy(java.lang.String name)
               throws java.lang.Exception
Deploy a package with the main deployer. The supplied name is interpreted as a url, or as a filename in jbosstest.deploy.lib or ../lib.

Parameters:
name - filename/url of package to deploy.
Throws:
java.lang.Exception - Description of Exception

undeploy

protected void undeploy(java.lang.String name)
                 throws java.lang.Exception
Undeploy a package with the main deployer. The supplied name is interpreted as a url, or as a filename in jbosstest.deploy.lib or ../lib.

Parameters:
name - filename/url of package to undeploy.
Throws:
java.lang.Exception - Description of Exception

getDeploySetup

public static Test getDeploySetup(Test test,
                                  java.lang.String jarNames)
                           throws java.lang.Exception
Get a JBossTestSetup that does login and deployment in setUp/tearDown

Parameters:
test - a Test
jarNames - is a comma seperated list of deployments
Throws:
java.lang.Exception

getJndiURL

protected java.lang.String getJndiURL()

getJndiInitFactory

protected java.lang.String getJndiInitFactory()

getThreadCount

protected int getThreadCount()

getIterationCount

protected int getIterationCount()

getBeanCount

protected int getBeanCount()

getServerHost

public java.lang.String getServerHost()
Get the JBoss server host from system property "jbosstest.host.name" This defaults to "localhost"


flushAuthCache

protected void flushAuthCache()
                       throws java.lang.Exception
Throws:
java.lang.Exception

flushAuthCache

protected void flushAuthCache(java.lang.String domain)
                       throws java.lang.Exception
Throws:
java.lang.Exception

restartDBPool

protected void restartDBPool()
                      throws java.lang.Exception
Restart the connection pool associated with the DefaultDS

Throws:
java.lang.Exception - on failure

sleep

protected void sleep(long interval)
              throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException