org.codehaus.ivory.plexus
Class IvoryTestCase

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.codehaus.plexus.PlexusTestCase
                    |
                    +--org.codehaus.ivory.plexus.IvoryTestCase
All Implemented Interfaces:
junit.framework.Test

public class IvoryTestCase
extends org.codehaus.plexus.PlexusTestCase

A generic test-case for testing Ivory and other SOAP services for Plexus.

Since:
May 4, 2003
Author:
Dan Diephouse

Field Summary
static java.lang.String VERBOSE_KEY
           
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
basedir
 
Constructor Summary
IvoryTestCase(java.lang.String name)
           
 
Method Summary
protected  void assertIsXml(java.lang.String response)
           
 void assertStringInBody(java.lang.String body, java.lang.String searchfor)
          Assert that the response contains a string.
protected  void assertStringInBody(com.meterware.httpunit.WebRequest request, java.lang.String searchfor)
          Assert that a named string is in the request body of the.
 void assertStringInBody(com.meterware.httpunit.WebResponse response, java.lang.String searchfor)
          Assert that the response contains a string.
 void assertStringInBody(com.meterware.httpunit.WebResponse response, java.lang.String searchfor, java.lang.String url)
          Assert that the response contains a string.
protected  void assertStringNotInBody(java.lang.String body, java.lang.String searchfor)
          Assert that a string is not in a response.
protected  void assertStringNotInBody(com.meterware.httpunit.WebRequest request, java.lang.String searchfor)
          Assert that a string is not in the response to a request.
protected  void assertStringNotInBody(com.meterware.httpunit.WebResponse response, java.lang.String searchfor)
          Assert that a string is not in a response.
protected  void assertStringNotInBody(com.meterware.httpunit.WebResponse response, java.lang.String searchfor, java.lang.String url)
          Assert that a string is not in a response.
 void assertValidWSDL(java.lang.String serviceName, java.lang.String method)
          Verifies that the service generates WSDL.
 void assertValidWSDL(java.lang.String serviceName, java.lang.String[] methods)
          Verifies that the service generates WSDL.
protected  void expectErrorCode(com.meterware.httpunit.WebRequest request, int errorCode, java.lang.String errorText)
          Here we expect an errorCode other than 200, and look for it checking for text is omitted as it doesnt work.
 java.lang.String getWSDL(java.lang.String serviceName)
           
 boolean isVerbose()
           
protected  com.meterware.httpunit.WebResponse makeRequest(com.meterware.httpunit.WebRequest request)
          Make a request in a new session.
protected  com.meterware.servletunit.ServletUnitClient newClient()
           
 void setUp()
           
 void setVerbose(boolean b)
           
 
Methods inherited from class org.codehaus.plexus.PlexusTestCase
getClassLoader, getConfiguration, getConfiguration, getContainer, getCustomConfiguration, getResourceAsStream, getTestFile, getTestFile, lookup, lookup, release, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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

VERBOSE_KEY

public static final java.lang.String VERBOSE_KEY
See Also:
Constant Field Values
Constructor Detail

IvoryTestCase

public IvoryTestCase(java.lang.String name)
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Overrides:
setUp in class org.codehaus.plexus.PlexusTestCase
java.lang.Exception

newClient

protected com.meterware.servletunit.ServletUnitClient newClient()
                                                         throws java.lang.Exception
java.lang.Exception

isVerbose

public boolean isVerbose()
Returns:

setVerbose

public void setVerbose(boolean b)
Parameters:
b -

assertStringInBody

public void assertStringInBody(java.lang.String body,
                               java.lang.String searchfor)
                        throws java.io.IOException
Assert that the response contains a string.

Parameters:
searchfor -
Throws:
java.io.IOException

assertStringInBody

public void assertStringInBody(com.meterware.httpunit.WebResponse response,
                               java.lang.String searchfor)
                        throws java.io.IOException
Assert that the response contains a string.

Parameters:
response -
searchfor -
Throws:
java.io.IOException

assertStringInBody

public void assertStringInBody(com.meterware.httpunit.WebResponse response,
                               java.lang.String searchfor,
                               java.lang.String url)
                        throws java.io.IOException
Assert that the response contains a string.

Parameters:
response -
searchfor -
url -
Throws:
java.io.IOException

assertStringInBody

protected void assertStringInBody(com.meterware.httpunit.WebRequest request,
                                  java.lang.String searchfor)
                           throws java.io.IOException,
                                  org.xml.sax.SAXException
Assert that a named string is in the request body of the. response to a request

Parameters:
request - what we ask
searchfor - string to look for
Throws:
java.io.IOException - when the fetch fails
org.xml.sax.SAXException

makeRequest

protected com.meterware.httpunit.WebResponse makeRequest(com.meterware.httpunit.WebRequest request)
                                                  throws java.io.IOException,
                                                         org.xml.sax.SAXException
Make a request in a new session.

Parameters:
request - request to make
Returns:
the response
Throws:
java.io.IOException
org.xml.sax.SAXException

assertStringNotInBody

protected void assertStringNotInBody(java.lang.String body,
                                     java.lang.String searchfor)
                              throws java.io.IOException
Assert that a string is not in a response.

Parameters:
searchfor -
Throws:
java.io.IOException

assertStringNotInBody

protected void assertStringNotInBody(com.meterware.httpunit.WebResponse response,
                                     java.lang.String searchfor)
                              throws java.io.IOException
Assert that a string is not in a response.

Parameters:
response -
searchfor -
Throws:
java.io.IOException

assertStringNotInBody

protected void assertStringNotInBody(com.meterware.httpunit.WebResponse response,
                                     java.lang.String searchfor,
                                     java.lang.String url)
                              throws java.io.IOException
Assert that a string is not in a response.

Parameters:
response -
searchfor -
url -
Throws:
java.io.IOException

assertStringNotInBody

protected void assertStringNotInBody(com.meterware.httpunit.WebRequest request,
                                     java.lang.String searchfor)
                              throws java.io.IOException,
                                     org.xml.sax.SAXException
Assert that a string is not in the response to a request.

Parameters:
request -
searchfor -
Throws:
java.io.IOException
org.xml.sax.SAXException

assertIsXml

protected void assertIsXml(java.lang.String response)

expectErrorCode

protected void expectErrorCode(com.meterware.httpunit.WebRequest request,
                               int errorCode,
                               java.lang.String errorText)
                        throws java.net.MalformedURLException,
                               java.io.IOException,
                               org.xml.sax.SAXException
Here we expect an errorCode other than 200, and look for it checking for text is omitted as it doesnt work. It would never work on java1.3, but one may have expected java1.4+ to have access to the error stream in responses. Clearly not.

Parameters:
request -
errorCode -
errorText - optional text string to search for
Throws:
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException

assertValidWSDL

public void assertValidWSDL(java.lang.String serviceName,
                            java.lang.String method)
                     throws java.lang.Exception
Verifies that the service generates WSDL.

Parameters:
method -
java.lang.Exception

getWSDL

public java.lang.String getWSDL(java.lang.String serviceName)
                         throws java.lang.Exception
java.lang.Exception

assertValidWSDL

public void assertValidWSDL(java.lang.String serviceName,
                            java.lang.String[] methods)
                     throws java.lang.Exception
Verifies that the service generates WSDL.

Parameters:
methods -
java.lang.Exception


Copyright © -2003 Codehaus. All Rights Reserved.