This easy-to-use tool allows you to dynamically manipulate data within a data repository following the standard CRUD model (Create, Read, Update, Delete).

In this section:

 

Prerequisites

Ensure you have a Data Repository data source which points to the data set you want to perform CRUD operations on.

Installation

  1. Choose Parasoft> Preferences.
  2. Open the Parasoft> System Properties page.
  3. Click Add JARS and choose and select the com.parasoft.soavirt.tool.datarepositorycrud-1.2.0.jar JAR file.

Configuration

  1. Attach an XML Transformer to the output you wish to use to update the data repository. The following example XML may be expected by the responder:

    <root>
    <identifier>10</identifier>
    <fname>sam</fname>
    </root>
  2. Click each element in the tree on the left-hand side of the XML Transformer you just added that should be used to update the data repository and click Add XPath 
  3. Expand the Options section in the bottom left-hand corner of the XML Transformer and enable the Allow alteration option.
  4. Click the Alter tab in the XML Transformer and perform the following actions for each element you added: 
    1. Click the element in the tree and click the Add XPath.
    2. Click the XPath you just added in the Selected XPaths list on the right-hand side and click the Modify button.
    3. In the alteration section, make sure the Prepend option is enabled and enter the name of the column that the element maps to in the data source followed by a colon. For example, if you want the <identifier> element in the sample XML above to map to the "id" column and the <fname> element to map to the "fname" column, you would prepend id: to identifier and prepend fname: to fname.
  5. Save the XML Transformer.
  6. Right-click the XML Transformer and chose Add output... 
  7. Choose Data Repository CRUD Tool from the list and click Finish.
  8. Enter the name of the operation you wish to perform on the repository in the Mode ('Create-Update' or 'Delete') field.
  9. Enter the name of the repository data source that points to the data set you'd like to perform CRUD operations on in the Repository Data Source Name.

Now when the SOAtest tool is run or the Virtualize Message responder is hit, the Data Repository CRUD Tool will perform the correct operation.

Running the Examples

  1. Prepare the data repository:
    1. Click Add in the Data Repositories view.
    2. Change the repository name to "datarepositorysample"
    3. Click Validate and confirm that you want to create the repository when prompted.
  2. Right-click the "datarepositorysample" Data Repository and click Import Repository. 
  3. Browse to sampleDataRepository.json and click Open.
  4. Copy updateRepository.pva into your VirtualAssets folder and deploy it to a remote server if necessary.
  5. Copy testDataRepositoryCRUDTool.tst into your workspace.
  6. Update the "VIRTUALIZE" environment in testDataRepositoryCRUDTool.tst to point to the Virtualize server you deployed updateRepository.pva.
  7. Run Test Suite: Update in Virtualize.
  • No labels