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
- Go to Parasoft > Preferences and click System Properties.
- Click Add JARS and select the com.parasoft.soavirt.tool.datarepositorycrud-1.2.0.jar file.
- Click Apply.
- Restart SOAtest/Virtualize.
Configuration
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>
- 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
- Expand the Options section in the bottom left-hand corner of the XML Transformer and enable Allow alteration.
- Click the Alter tab in the XML Transformer and perform the following actions for each element you added:
- Click the element in the tree and click Add XPath.
- Click the XPath you just added in the Selected XPaths list on the right-hand side and click Modify.
- 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 prependid:
toidentifier
and prependfname:
tofname
.
- Save the XML Transformer.
- Right-click the XML Transformer and chose Add output...
- Choose Data Repository CRUD Tool from the list and click Finish.
- Enter the name of the operation you wish to perform on the repository in the Mode ('Create-Update' or 'Delete') field.
- 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
- Prepare the data repository:
- Click Add in the Data Repositories view.
- Change the repository name to "datarepositorysample"
- Click Validate and confirm that you want to create the repository when prompted.
- Right-click the
datarepositorysample
Data Repository and click Import Repository. - Browse to sampleDataRepository.json and click Open.
- Copy updateRepository.pva into your
VirtualAssets
folder and deploy it to a remote server if necessary. - Copy testDataRepositoryCRUDTool.tst into your workspace.
- Update the "VIRTUALIZE" environment in testDataRepositoryCRUDTool.tst to point to the Virtualize server you deployed updateRepository.pva.
- Run Test Suite: Update in Virtualize.