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

In this section:

 

Prerequisites

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

Installation

  1. Go to Parasoft > Preferences and click System Properties.
  2. Click Add JARS and select the com.parasoft.soavirt.tool.datarepositorycrud-1.2.0.jar file.
  3. Click Apply.
  4. Restart SOAtest/Virtualize.

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, then click Add XPath 
  3. Expand the Options section in the bottom left-hand corner of the XML Transformer and enable Allow alteration.
  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 Add XPath.
    2. Click the XPath you just added in the Selected XPaths list on the right-hand side and click Modify.
    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 wanted 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