WSO2 GREG uses RXT files to describe the data model of an artifact. There are mainly two steps in creating an artifact using RXT files.
- Creating the RXT file. You can find details about the syntax used in RXT files in here.
- Deploying created RXT file in GREG. This is described in detail in here.
Relationship Model
Following is an explanation about the relationship model used in the
GREG’s RXT files. In RXT files, we use the “relationships element”
(more details here)
to define relationships between two artificats. You can find several
RXT examples inside
directory. Following is an extract from the sample file
1
$GREG_HOME/samples/asset- models
.1
$GREG_HOME/samples/asset-models/TestPlanModel/registry-extensions/TestSuite.rxt
1
2
3
4
<relationships>
<association type="usedBy" source="@{testCases_entry:value}"/>
<dependency type="depends" target="@{testCases_entry:value}"/>
</relationships>
Here in line 2, we have added a “usedBy” association in the TestCase artifact to the TestSuite artifact using the association element. Note that we have used source attribute to indicate that the relationship is from “TestCase” to “TestSuite”. In the line 3 we have added a dependency in the TestSuite on “TestCase”. Note that we have used the “target” attribute to indicate that the relationship is from “TestSuite” to “TestCase”. The relationships element only indicate the type of relationship. To make it relate to one or many, we can use different type of fields. You can find a description about available field types from here.
If we look at the same sample file we took earlier we can see that a “TestSuite” artifact have an association with many “TestCase” artifacts. The relevant RXT code is mentioned below.
1
2
3
4
5
6
7
8
9
10
11
12
<table name="TestCases">
<subheading>
<heading>Type</heading>
<heading>Path</heading>
</subheading>
<field type="option-text" maxoccurs="unbounded" path="true">
<name>Case</name>
<values>
<value>Test Case</value>
</values>
</field>
</table>
In line 6 we have defined the field type as “option-text” with attribute “maxoccurs” set to “unbounded”. Therefore we can add many TestCases for a Testsuite. If we have used a field of type text field then a TestSuite can have only one TestCase.
Similarly you can use different combination of the “relationships” elements and field elements to create different relationship patterns.
Examples
Some Examples are listed below, I am taking “Project group” and “Person” as artifcats for following examples. I have only shown the relevant parts of the RXT file. You have to add all other required elements to make it a valid RXT file.