org.apache.cactus.integration.ant.container
Class AbstractContainer

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.cactus.integration.ant.container.AbstractContainer
All Implemented Interfaces:
Container
Direct Known Subclasses:
AbstractJavaContainer, GenericContainer

public abstract class AbstractContainer
extends org.apache.tools.ant.ProjectComponent
implements Container

Abstract base class for supporting specific containers as nested elements in the CactusTask.

Version:
$Id: AbstractContainer.java,v 1.19 2005/01/29 15:49:18 vmassol Exp $

Constructor Summary
AbstractContainer()
           
 
Method Summary
 org.apache.tools.ant.types.PatternSet.NameEntry createExclude()
          Creates a nested exclude element that is added to the pattern set.
 java.lang.String getBaseURL()
           
 org.apache.tools.ant.types.Path getContainerClasspath()
           
 java.lang.String[] getExcludePatterns()
          Returns the exclude patterns.
 java.lang.String getProtocol()
          Returns the protocol, that should be used for communication to the container.
 java.lang.String getServer()
          Returns the server (name or IP) to where the container is living.
 long getStartUpWait()
           
 org.apache.tools.ant.types.Environment.Variable[] getSystemProperties()
           
 java.lang.String getTestContext()
           
 java.io.File getToDir()
          Returns the value of the 'todir' attribute.
 void init()
          The default implementation does nothing.
 boolean isEnabled()
          Returns whether the container element is enabled, which is determined by the evaluation of the if- and unless conditions
 boolean isExcluded(java.lang.String theTestName)
          Returns whether a specific test case is to be excluded from being run in the container.
 void setAntTaskFactory(AntTaskFactory theFactory)
          Sets the factory to use for creating Ant tasks.
 void setContainerClasspath(org.apache.tools.ant.types.Path theClasspath)
          Sets additional classpath entries that will be added to the container classpath used to start the containers.
 void setDeployableFile(DeployableFile theDeployableFile)
          Sets the file that should be deployed to the container.
 void setIf(java.lang.String theIfCondition)
          Sets the name of a property that must exist in the project if tests are to be run on the container.
 void setLog(org.apache.commons.logging.Log theLog)
          Sets the log which the implementation should use.
 void setProtocol(java.lang.String theProtocol)
          Sets the protocol the container should use
 void setServer(java.lang.String theServer)
          Sets the server (name or ip) to which the container is living.
 void setStartUpWait(long theStartUpWait)
          Sets the time to wait after the container has been started up.
 void setSystemProperties(org.apache.tools.ant.types.Environment.Variable[] theProperties)
          Sets the system properties that will be passed to the JVM in which the server will execute.
 void setToDir(java.io.File theToDir)
          Sets the directory to which the test reports should be written.
 void setUnless(java.lang.String theUnlessCondition)
          Sets the name of a property that must not exist in the project if tests are to be run on the container.
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, log, log, setProject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cactus.integration.ant.container.Container
getName, getPort, shutDown, startUp
 

Constructor Detail

AbstractContainer

public AbstractContainer()
Method Detail

getTestContext

public java.lang.String getTestContext()
Specified by:
getTestContext in interface Container
Returns:
the context that the webapp will load on, null if the client should determine on it's own
See Also:
Container.getTestContext()

setStartUpWait

public void setStartUpWait(long theStartUpWait)
Sets the time to wait after the container has been started up. The default time is 1 second. Note: This is a hack while waiting for container specific solutions that tell exactly when the server is started or not. ATM, the only known issue is with JBoss, where the servlet engine is started before the full JBoss is started and thus it may happen that we try to shutdown JBoss before it has finished starting, leading to an exception.

Parameters:
theStartUpWait - The time to wait in milliseconds

createExclude

public final org.apache.tools.ant.types.PatternSet.NameEntry createExclude()
Creates a nested exclude element that is added to the pattern set.

Returns:
The created exclude element

getExcludePatterns

public final java.lang.String[] getExcludePatterns()
Returns the exclude patterns.

Returns:
The exclude patterns

setIf

public final void setIf(java.lang.String theIfCondition)
Sets the name of a property that must exist in the project if tests are to be run on the container.

Parameters:
theIfCondition - The property name to set

setToDir

public final void setToDir(java.io.File theToDir)
Sets the directory to which the test reports should be written.

Parameters:
theToDir - The output directory to set

setUnless

public final void setUnless(java.lang.String theUnlessCondition)
Sets the name of a property that must not exist in the project if tests are to be run on the container.

Parameters:
theUnlessCondition - The property name to set

setServer

public final void setServer(java.lang.String theServer)
Sets the server (name or ip) to which the container is living.

Parameters:
theServer - The server to set

setProtocol

public final void setProtocol(java.lang.String theProtocol)
Sets the protocol the container should use

Parameters:
theProtocol - The protocol to set

getStartUpWait

public long getStartUpWait()
Specified by:
getStartUpWait in interface Container
Returns:
the time to wait after the container has been started up.
See Also:
Container.getStartUpWait()

getToDir

public final java.io.File getToDir()
Description copied from interface: Container
Returns the value of the 'todir' attribute.

Specified by:
getToDir in interface Container
Returns:
The output directory
See Also:
Container.getToDir()

init

public void init()
The default implementation does nothing.

Specified by:
init in interface Container
See Also:
Container.init()

isEnabled

public final boolean isEnabled()
Description copied from interface: Container
Returns whether the container element is enabled, which is determined by the evaluation of the if- and unless conditions

Specified by:
isEnabled in interface Container
Returns:
true if the container is enabled
See Also:
Container.isEnabled()

isExcluded

public final boolean isExcluded(java.lang.String theTestName)
Description copied from interface: Container
Returns whether a specific test case is to be excluded from being run in the container.

Specified by:
isExcluded in interface Container
Parameters:
theTestName - The fully qualified name of the test fixture class
Returns:
true if the test should be excluded, otherwise false
See Also:
Container.isExcluded(java.lang.String)

setAntTaskFactory

public final void setAntTaskFactory(AntTaskFactory theFactory)
Description copied from interface: Container
Sets the factory to use for creating Ant tasks.

Specified by:
setAntTaskFactory in interface Container
Parameters:
theFactory - The factory to use for creating Ant tasks
See Also:
Container.setAntTaskFactory(org.apache.cactus.integration.ant.util.AntTaskFactory)

setDeployableFile

public final void setDeployableFile(DeployableFile theDeployableFile)
Description copied from interface: Container
Sets the file that should be deployed to the container. This can be either a WAR or an EAR file, depending on the capabilities of the container.

Specified by:
setDeployableFile in interface Container
Parameters:
theDeployableFile - The file to deploy
See Also:
Container.setDeployableFile(org.apache.cactus.integration.ant.deployment.DeployableFile)

setLog

public final void setLog(org.apache.commons.logging.Log theLog)
Description copied from interface: Container
Sets the log which the implementation should use.

Specified by:
setLog in interface Container
Parameters:
theLog - The log to set
See Also:
Container.setLog(org.apache.commons.logging.Log)

setSystemProperties

public void setSystemProperties(org.apache.tools.ant.types.Environment.Variable[] theProperties)
Description copied from interface: Container
Sets the system properties that will be passed to the JVM in which the server will execute.

Specified by:
setSystemProperties in interface Container
Parameters:
theProperties - the list of system properties to set in the container JVM
See Also:
Container.setSystemProperties(org.apache.tools.ant.types.Environment.Variable[])

getSystemProperties

public org.apache.tools.ant.types.Environment.Variable[] getSystemProperties()
Specified by:
getSystemProperties in interface Container
Returns:
the list of system properties that will be set in the container JVM
See Also:
Container.getSystemProperties()

setContainerClasspath

public void setContainerClasspath(org.apache.tools.ant.types.Path theClasspath)
Description copied from interface: Container
Sets additional classpath entries that will be added to the container classpath used to start the containers.

Specified by:
setContainerClasspath in interface Container
Parameters:
theClasspath - the container classpath entries to add
Since:
Cactus 1.6
See Also:
Container.setContainerClasspath(Path)

getContainerClasspath

public org.apache.tools.ant.types.Path getContainerClasspath()
Specified by:
getContainerClasspath in interface Container
Returns:
additional container classpath entries
Since:
Cactus 1.6
See Also:
Container.getContainerClasspath()

getServer

public final java.lang.String getServer()
Description copied from interface: Container
Returns the server (name or IP) to where the container is living.

Specified by:
getServer in interface Container
Returns:
The server
See Also:
Container.getServer()

getProtocol

public final java.lang.String getProtocol()
Description copied from interface: Container
Returns the protocol, that should be used for communication to the container.

Specified by:
getProtocol in interface Container
Returns:
The protocol
See Also:
Container.getProtocol()

getBaseURL

public final java.lang.String getBaseURL()
Specified by:
getBaseURL in interface Container
Returns:
the base URL of the container, including protocol, name and port
See Also:
Container.getBaseURL()


Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.