com.mycila.testing.plugins.jetty.config
Class DefaultConfig

java.lang.Object
  extended by com.mycila.testing.plugins.jetty.config.DefaultConfig
All Implemented Interfaces:
Config, RawConfig

public class DefaultConfig
extends Object
implements Config

The default implementation with default values of RawConfig and provides Configuration extension.


Field Summary
static Class<? extends RawConfig> DEFAULT_CONFIG_CLASS
          The default JettyRunWar.value() RawConfiguration class.
static String DEFAULT_CONTEXT_PATH
          The default value of getContextPath().
static Class<? extends ServerLifeCycleListener> DEFAULT_CYCLE_LISTENER_CLASS
          The default value of getServerLifeCycleListenerClass().
static String DEFAULT_CYCLE_LISTENER_CLASS_AS_STRING
          The default value of getServerLifeCycleListenerClass() as string.
static boolean DEFAULT_DEPLOY_WEBAPP
          The default value of isDeployWebapp().
static String DEFAULT_DEPLOY_WEBAPP_AS_STRING
          The default value of isDeployWebapp() as string.
static int DEFAULT_SERVER_PORT
          The default value of getServerPort().
static String DEFAULT_SERVER_PORT_AS_STRING
          The default value of getServerPort() as string.
static boolean DEFAULT_SKIP
          The default value of isSkip().
static String DEFAULT_SKIP_AS_STRING
          The default value of isSkip() as string.
static boolean DEFAULT_START_SERVER
          The default value of isStartServer().
static String DEFAULT_START_SERVER_AS_STRING
          The default value of isStartServer() as string.
static String DEFAULT_WAR_LOCATION
          The default value of getWarLocation().
 
Constructor Summary
DefaultConfig()
          Instantiates.
DefaultConfig(Properties config)
          Instantiates with a Properties configuration such as keys : warLocation : String # getWarLocation(), ie : ant:*.war serverPort : int # getServerPort(), ie : 9090 contextPath : String # getContextPath(), ie : /test startServer : boolean (true|false) # isStartServer(), ie : true deployWebapp : boolean (true|false) # isDeployWebapp(), ie : false skip : boolean (true|false) # isSkip(), ie : true lifeCycleListenerClass : String classname # getServerLifeCycleListenerClass(), ie : com.mycila.testing.plugins.jetty.NopServerLifeCycleListener
DefaultConfig(RawConfig config)
          Instantiates with a RawConfiguration;
 
Method Summary
static Config configFrom(Class<?> klass)
          Returns the JettyRunWar Configuration for the klass.
static Config configFrom(Method method)
          Returns the JettyRunWar Configuration for the method.
 String getContextPath()
          The web application context path.
 ServerLifeCycleListener getServerLifeCycleListener()
          The ServerLifeCycleListener instance which allow customization of the server configuration.
 Class<? extends ServerLifeCycleListener> getServerLifeCycleListenerClass()
          The ServerLifeCycleListener class which allow customization of the server configuration.
 int getServerPort()
          The web application server port.
 Class<?> getSourceClass()
          Returns the JettyRunWar source class.
 JettyRunWar getSourceConfig()
          Returns the JettyRunWar source configuration.
 Method getSourceMethod()
          Returns the JettyRunWar source configuration.
 String getWarLocation()
          The location of the WAR file to load.
 URL getWarLocationUrl()
          The location of the WAR file to load.
static boolean hasJettyPlugin(Class<?> klass)
          Returns true if the klass is annotation with JettyRunWar, false else.
static boolean hasJettyPlugin(Method method)
          Returns true if the method is annotation with JettyRunWar, false else.
 boolean isDeployWebapp()
          True to deploy a new webapp (and undeploy the old one), false to deploy a webapp only if there is no deployed one.
 boolean isSkip()
          True to skip starting server or deploying webapp.
 boolean isStartServer()
          True to start a new server (and stop the old one), false to start a server only if there is no running one.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CONFIG_CLASS

public static final Class<? extends RawConfig> DEFAULT_CONFIG_CLASS
The default JettyRunWar.value() RawConfiguration class.


DEFAULT_WAR_LOCATION

public static final String DEFAULT_WAR_LOCATION
The default value of getWarLocation().

See Also:
Constant Field Values

DEFAULT_SERVER_PORT

public static final int DEFAULT_SERVER_PORT
The default value of getServerPort().

See Also:
Constant Field Values

DEFAULT_SERVER_PORT_AS_STRING

public static final String DEFAULT_SERVER_PORT_AS_STRING
The default value of getServerPort() as string.


DEFAULT_CONTEXT_PATH

public static final String DEFAULT_CONTEXT_PATH
The default value of getContextPath().

See Also:
Constant Field Values

DEFAULT_START_SERVER

public static final boolean DEFAULT_START_SERVER
The default value of isStartServer().

See Also:
Constant Field Values

DEFAULT_START_SERVER_AS_STRING

public static final String DEFAULT_START_SERVER_AS_STRING
The default value of isStartServer() as string.


DEFAULT_DEPLOY_WEBAPP

public static final boolean DEFAULT_DEPLOY_WEBAPP
The default value of isDeployWebapp().

See Also:
Constant Field Values

DEFAULT_DEPLOY_WEBAPP_AS_STRING

public static final String DEFAULT_DEPLOY_WEBAPP_AS_STRING
The default value of isDeployWebapp() as string.


DEFAULT_SKIP

public static final boolean DEFAULT_SKIP
The default value of isSkip().

See Also:
Constant Field Values

DEFAULT_SKIP_AS_STRING

public static final String DEFAULT_SKIP_AS_STRING
The default value of isSkip() as string.


DEFAULT_CYCLE_LISTENER_CLASS

public static final Class<? extends ServerLifeCycleListener> DEFAULT_CYCLE_LISTENER_CLASS
The default value of getServerLifeCycleListenerClass().


DEFAULT_CYCLE_LISTENER_CLASS_AS_STRING

public static final String DEFAULT_CYCLE_LISTENER_CLASS_AS_STRING
The default value of getServerLifeCycleListenerClass() as string.

Constructor Detail

DefaultConfig

public DefaultConfig()
Instantiates.


DefaultConfig

public DefaultConfig(Properties config)
Instantiates with a Properties configuration such as keys :

Parameters:
config - the Properties configuration.
Throws:
RuntimeException - if the setServerLifeCycleListenerClass(Class) does not exist in the VM.
NumberFormatException - if the setServerPort(int) is not an int.

DefaultConfig

public DefaultConfig(RawConfig config)
Instantiates with a RawConfiguration;

Parameters:
config - the raw configuration;
Method Detail

getWarLocationUrl

public URL getWarLocationUrl()
The location of the WAR file to load.

Specified by:
getWarLocationUrl in interface Config
Returns:
the location of the WAR file to load.
See Also:
Config.getWarLocationUrl()

getWarLocation

public String getWarLocation()
The location of the WAR file to load. The search is based on the current directory.

Default is . If there is more than one WAR file the test will fail, else the WAR file will be loaded and the test run.

WAR locator strategy :

Specified by:
getWarLocation in interface RawConfig
Returns:
location of the WAR file to load.
See Also:
RawConfig.getWarLocation()

getServerPort

public int getServerPort()
The web application server port. Default is .

Specified by:
getServerPort in interface RawConfig
Returns:
the web application server port.
See Also:
RawConfig.getServerPort()

getContextPath

public String getContextPath()
The web application context path. Must starts with a slash '/' but doesn't end with one except for root context path. Default is .

Specified by:
getContextPath in interface RawConfig
Returns:
the web application context path.
See Also:
RawConfig.getContextPath()

isStartServer

public boolean isStartServer()
True to start a new server (and stop the old one), false to start a server only if there is no running one. If true then RawConfig.isDeployWebapp() is logically force to true. Default .

Specified by:
isStartServer in interface RawConfig
Returns:
true to start a new server (and stop the old one), false to start a server only if there is no running one.
See Also:
RawConfig.isStartServer()

isDeployWebapp

public boolean isDeployWebapp()
True to deploy a new webapp (and undeploy the old one), false to deploy a webapp only if there is no deployed one. Default

Specified by:
isDeployWebapp in interface RawConfig
Returns:
true to deploy a new webapp (and undeploy the old one), false to deploy a webapp only if there is no deployed one.
See Also:
RawConfig.isDeployWebapp()

isSkip

public boolean isSkip()
True to skip starting server or deploying webapp. Default is .

Specified by:
isSkip in interface RawConfig
Returns:
true to skip starting server or deploying webapp.
See Also:
RawConfig.isSkip()

getServerLifeCycleListener

public ServerLifeCycleListener getServerLifeCycleListener()
Description copied from interface: Config
The ServerLifeCycleListener instance which allow customization of the server configuration.

Specified by:
getServerLifeCycleListener in interface Config
Returns:
the server lifecycle listener instance.

getServerLifeCycleListenerClass

public Class<? extends ServerLifeCycleListener> getServerLifeCycleListenerClass()
The ServerLifeCycleListener class which allow customization of the server configuration. Default is .

Specified by:
getServerLifeCycleListenerClass in interface RawConfig
Returns:
the server lifecycle listener class.
See Also:
RawConfig.getServerLifeCycleListenerClass()

getSourceConfig

public JettyRunWar getSourceConfig()
Returns the JettyRunWar source configuration.

Specified by:
getSourceConfig in interface Config
Returns:
the JettyRunWar source configuration.
See Also:
Config.getSourceConfig()

getSourceMethod

public Method getSourceMethod()
Returns the JettyRunWar source configuration.

Specified by:
getSourceMethod in interface Config
Returns:
the JettyRunWar source configuration.
See Also:
Config.getSourceMethod()

getSourceClass

public Class<?> getSourceClass()
Returns the JettyRunWar source class.

Specified by:
getSourceClass in interface Config
Returns:
the JettyRunWar source class.
See Also:
Config.getSourceClass()

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()

hasJettyPlugin

public static boolean hasJettyPlugin(Method method)
Returns true if the method is annotation with JettyRunWar, false else.

Parameters:
method - the method to test if annotated with JettyRunWar.
Returns:
true if the method is annotation with JettyRunWar, false else.

hasJettyPlugin

public static boolean hasJettyPlugin(Class<?> klass)
Returns true if the klass is annotation with JettyRunWar, false else.

Parameters:
klass - the class to test if annotated with JettyRunWar.
Returns:
true if the klass is annotation with JettyRunWar, false else.

configFrom

public static Config configFrom(Method method)
Returns the JettyRunWar Configuration for the method.

Parameters:
method - the method for which returns the JettyRunWar Configuration.
Returns:
the JettyRunWar Configuration.

configFrom

public static Config configFrom(Class<?> klass)
Returns the JettyRunWar Configuration for the klass.

Parameters:
klass - the class for which returns the JettyRunWar Configuration.
Returns:
the JettyRunWar Configuration.


Copyright © 2010-2011 Mycila. All Rights Reserved.