gov.grants.apply.agency
Class WSTestClient

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bygov.grants.apply.agency.WSTestClient
All Implemented Interfaces:
junit.framework.Test

public class WSTestClient
extends junit.framework.TestCase

Junit Test Case for invoking the Grants.gov Agency Web Services. A full implemenation of GetApplication, GetApplicationList, GetApplicationZip and ConfirmApplicationDelievery is provided. A full implementation of GetApplicationZip is provided that writtes the zip files to a configurable directory. Support for both DIME and MIME attachment encoding specifications are enabled in this implemenation.

Author:
Brian Husted

Field Summary
(package private) static int BUFFER
           
static java.lang.String DIME_ENCODING
           
static java.lang.String DIR_TO_WRITE_APPS
           
static java.lang.String ENCODING_TYPE
           
(package private) static org.apache.log4j.Logger log
           
static java.lang.String LOG_4J_CONFIG_FILE
           
static java.lang.String PROP_FILE
           
static java.lang.String RESOURCES_LOG_4J_CONFIG_FILE
           
static java.lang.String SOAP_HOST
           
static java.lang.String SOAP_PORT
           
static java.lang.String TEST_MODE
           
 
Constructor Summary
WSTestClient(java.lang.String str)
           
 
Method Summary
protected static void confirmApplication(java.lang.String application_id)
           
protected static org.w3c.dom.Node getApplication(java.lang.String applicationId)
           
protected static gov.grants.apply.WebServices.AgencyIntegrationServices_V1_0.ApplicationInformationType[] getApplicationList()
           
protected static org.apache.axis.attachments.AttachmentPart getApplicationZip(java.lang.String applicationId)
           
protected static gov.grants.apply.WebServices.AgencyIntegrationServices_V1_0.EncodingTypeEnum getAttachmentEncodingType()
           
protected static java.lang.String getFirstTrackingIdFromList()
           
static void init()
           
static void main(java.lang.String[] args)
           
protected static void processApplication(java.lang.String application_id)
           
static void processApplications()
          Retrieves all the applications by calling GetApplicationList.
static void testConfirmApplicationDelivery()
          Invokes the ConfirmApplicationDelivery Grants.gov web service.
static void testGetApplication()
          Invokes the GetApplication Grants.gov web service.
static void testGetApplicationList()
          Invokes the Grants.gov GetApplicationList Web Service and logs the number of applications in the list.
static void testGetApplicationZip()
          Invokes the Grants.gov GetApplicationZip web service.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, 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

PROP_FILE

public static final java.lang.String PROP_FILE
See Also:
Constant Field Values

log

static final org.apache.log4j.Logger log

LOG_4J_CONFIG_FILE

public static final java.lang.String LOG_4J_CONFIG_FILE
See Also:
Constant Field Values

RESOURCES_LOG_4J_CONFIG_FILE

public static final java.lang.String RESOURCES_LOG_4J_CONFIG_FILE
See Also:
Constant Field Values

DIR_TO_WRITE_APPS

public static final java.lang.String DIR_TO_WRITE_APPS
See Also:
Constant Field Values

SOAP_HOST

public static final java.lang.String SOAP_HOST
See Also:
Constant Field Values

SOAP_PORT

public static final java.lang.String SOAP_PORT
See Also:
Constant Field Values

TEST_MODE

public static final java.lang.String TEST_MODE
See Also:
Constant Field Values

ENCODING_TYPE

public static final java.lang.String ENCODING_TYPE
See Also:
Constant Field Values

DIME_ENCODING

public static final java.lang.String DIME_ENCODING
See Also:
Constant Field Values

BUFFER

static final int BUFFER
See Also:
Constant Field Values
Constructor Detail

WSTestClient

public WSTestClient(java.lang.String str)
Parameters:
str -
Method Detail

init

public static void init()

testGetApplicationList

public static void testGetApplicationList()
                                   throws java.lang.Exception
Invokes the Grants.gov GetApplicationList Web Service and logs the number of applications in the list.

Throws:
java.lang.Exception

testGetApplicationZip

public static void testGetApplicationZip()
                                  throws java.lang.Exception
Invokes the Grants.gov GetApplicationZip web service. First application returned from the Grants.gov GetApplicationList web service is used. The zip is then written to disk.

Throws:
java.lang.Exception

testGetApplication

public static void testGetApplication()
                               throws java.lang.Exception
Invokes the GetApplication Grants.gov web service. First application returned from the Grants.gov GetApplicationList web service is used. The XML and attachments are returned.

Throws:
java.lang.Exception

testConfirmApplicationDelivery

public static void testConfirmApplicationDelivery()
                                           throws java.lang.Exception
Invokes the ConfirmApplicationDelivery Grants.gov web service.

Throws:
java.lang.Exception

getFirstTrackingIdFromList

protected static java.lang.String getFirstTrackingIdFromList()
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

processApplications

public static void processApplications()
                                throws java.lang.Exception
Retrieves all the applications by calling GetApplicationList. For each application, the GetApplicationZip web service is invoked and the zip is written to disk. If everything is successful, the ConfirmApplicationDelievery web service is called

Throws:
java.lang.Exception

getApplicationList

protected static gov.grants.apply.WebServices.AgencyIntegrationServices_V1_0.ApplicationInformationType[] getApplicationList()
                                                                                                                      throws java.lang.Exception
Throws:
java.lang.Exception

processApplication

protected static void processApplication(java.lang.String application_id)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getApplicationZip

protected static org.apache.axis.attachments.AttachmentPart getApplicationZip(java.lang.String applicationId)
                                                                       throws java.lang.Exception
Throws:
java.lang.Exception

getApplication

protected static org.w3c.dom.Node getApplication(java.lang.String applicationId)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

getAttachmentEncodingType

protected static gov.grants.apply.WebServices.AgencyIntegrationServices_V1_0.EncodingTypeEnum getAttachmentEncodingType()
                                                                                                                 throws java.lang.Exception
Throws:
java.lang.Exception

confirmApplication

protected static void confirmApplication(java.lang.String application_id)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception