Testing a Plug-in
The business application plug-in can be tested by creating a test harness, using the CPF web site or using a CPF client to connect to the CPF web services.
CPF Web Site
If the CPF is deployed to /cpf on localhost the list of business applications can be found using the following page.
(http://localhost/cpf/ws/apps/)
Click on the link for a business application to get the list of resources for that application. Depending on the plug-in the following resources maybe available.
Resource | Description |
---|---|
specification | The HTML page describing the parameters and result attributes of the business application. |
instant | If the plug-in allows instant mode there will be a form that allows a user to submit a single request and get the results back immediately. |
single | The single request form allows the parameters for a single request to be entered using form fields insteadof requiring a file of structured input data. Unlike the instant mode the request is processed via a job. |
multiple | The multiple request form contains fields for the job parameters and accepts a file upload or a URL forthe request data fields. |
Use one of the above forms to create a new job and then download the results to confirm that the plug-in works as expected.
Test Harness
The BusinessApplicationPluginExecutor class allows developers to execute a single request against their plug-in without deploying it to the CPF infrastructure. The executor converts the input parameters to a JSON object and back again to simulate what happens in the internal CPF processing.
To create a test harness construct an instance of ca.bc.gov.open.cpf.plugin.api.BusinessApplicationPluginExecutor and then use one of the following methods to invoke the plug-in.