org.apache.ws.util.test.axis
Class AbstractAxisTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.ws.util.test.axis.AbstractAxisTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractMultipleAxisTestCase, AbstractNoAxisTestCase, AbstractOneAxisTestCase

public abstract class AbstractAxisTestCase
extends junit.framework.TestCase

Provides some conviencence functionality for easier testing of web services. Methods provided by this JUnit test case superclass will allow an embedded Axis server to be started and stopped.

Author:
mazz

Field Summary
 boolean RUN_AXIS_SERVER
          This constant is used for enabling/disabling the use of the embedded axis server.
 
Constructor Summary
AbstractAxisTestCase()
           
AbstractAxisTestCase(boolean runServer)
          Enables/Disables the running of the Axis server.
AbstractAxisTestCase(java.lang.String name)
           
 
Method Summary
protected  java.net.URL getAxisBaseUrl()
          Returns the base URL used to contact the Axis server.
protected  java.lang.String getAxisConfigBasePath()
          Returns the full directory path containing the WSDD configuration file(s).
protected  java.lang.String getAxisConfigFileName()
          Returns the filename of the actual Axis WSDD configuration file, excluding all directory paths.
protected  java.lang.String getAxisContextName()
          Returns the context name of the Axis servlet for use within an endpoint URL.
protected  NotSoSimpleAxisServer getAxisServer()
           
protected  int getAxisServerSocketPort()
          Returns the number of the port that the embedded Axis server will accept requests on.
protected  java.net.URL getAxisWebServiceUrl(java.lang.String serviceName)
          Returns a URL used to request a WSDL document for a web service with the given name.
protected  java.net.URL getAxisWebServiceWsdlUrl(java.lang.String serviceName)
          Returns a URL used to request a WSDL document for a web service with the given name.
protected  org.apache.axis.configuration.FileProvider getFileProvider()
           
protected  void setAxisServer(NotSoSimpleAxisServer server)
          This setter is to allow subclasses to tell us if we should use an already existing Axis server.
protected  void startAxisServer()
          Reads in the Axis configuration file, creates a server socket to accept requests and then starts the embedded Axis server.
protected  void stopAxisServer()
          Stops the embedded Axis server if it is running.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RUN_AXIS_SERVER

public boolean RUN_AXIS_SERVER
This constant is used for enabling/disabling the use of the embedded axis server.

Constructor Detail

AbstractAxisTestCase

public AbstractAxisTestCase()
See Also:
TestCase.TestCase()

AbstractAxisTestCase

public AbstractAxisTestCase(boolean runServer)
Enables/Disables the running of the Axis server. The DEFAULT is true (run Axis server) The reason for adding this is to allow derived test cases which can either use the underlying SimpleAxisServer or "turn-off" that functionality and hit a runnign instance.

Parameters:
runServer -

AbstractAxisTestCase

public AbstractAxisTestCase(java.lang.String name)
See Also:
TestCase.TestCase(String)
Method Detail

getAxisBaseUrl

protected java.net.URL getAxisBaseUrl()
Returns the base URL used to contact the Axis server. To access a web service hosted inside of the embedded Axis server, append the name of the web service to this base URL.

Subclasses may override this method if the default is not acceptable. The default is http://127.0.0.1:####/axis/services/ where #### is the Axis port number and axis is the Axis context name.

Returns:
base URL for all web services hosted in the embedded Axis server

getAxisConfigBasePath

protected java.lang.String getAxisConfigBasePath()
Returns the full directory path containing the WSDD configuration file(s). This is the base path that is prepended to the configuration file name.

Subclasses may override this method if the default is not acceptable. The default is the current directory as defined by the system property user.dir.

Returns:
filename of the WSDD configuration file

getAxisConfigFileName

protected java.lang.String getAxisConfigFileName()
Returns the filename of the actual Axis WSDD configuration file, excluding all directory paths.

Subclasses may override this method if the default is not acceptable. The default is server-config.wsdd.

Returns:
filename of the WSDD configuration file

getAxisContextName

protected java.lang.String getAxisContextName()
Returns the context name of the Axis servlet for use within an endpoint URL.

Returns:
context name of the Axis servlet

setAxisServer

protected void setAxisServer(NotSoSimpleAxisServer server)
This setter is to allow subclasses to tell us if we should use an already existing Axis server.

Parameters:
server - the embedded Axis server to be used by the tests

getAxisServer

protected NotSoSimpleAxisServer getAxisServer()
Returns:
the embedded Axis server to be used by the tests

getAxisServerSocketPort

protected int getAxisServerSocketPort()
Returns the number of the port that the embedded Axis server will accept requests on.

Subclasses may override this method if the default is not acceptable. The default is 8080.

Returns:
port number that the Axis server will listen to

getAxisWebServiceUrl

protected java.net.URL getAxisWebServiceUrl(java.lang.String serviceName)
Returns a URL used to request a WSDL document for a web service with the given name. This method uses getAxisBaseUrl() to determine the base URL.

Parameters:
serviceName - the name of the web service
Returns:
URL used to request a web service WSDL document
See Also:
getAxisBaseUrl()

getAxisWebServiceWsdlUrl

protected java.net.URL getAxisWebServiceWsdlUrl(java.lang.String serviceName)
Returns a URL used to request a WSDL document for a web service with the given name. This method uses getAxisBaseUrl() to determine the base URL.

Parameters:
serviceName - the name of the web service
Returns:
URL used to request a web service WSDL document
See Also:
getAxisBaseUrl()

startAxisServer

protected void startAxisServer()
                        throws java.lang.Exception
Reads in the Axis configuration file, creates a server socket to accept requests and then starts the embedded Axis server.

Throws:
java.lang.Exception - if failed to get the configuration file, failed to start the server socket or failed to start the server

getFileProvider

protected org.apache.axis.configuration.FileProvider getFileProvider()
                                                              throws org.apache.axis.ConfigurationException
Throws:
org.apache.axis.ConfigurationException

stopAxisServer

protected void stopAxisServer()
Stops the embedded Axis server if it is running.



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