An interpreted data source is a tabular data source that is regarded by SOAtest as a relational representation of a Java object graph. An interpreted data source can be used to facilitate creation of multiple Java objects and object graphs that can be used as test parameter inputs by the EJB Client Tool and other SOAtest tools. For more information on the EJB Client tool, see EJB Client.
To generate a Data Source from the fields of a Java Bean:
The following are the main concepts of the relational to object mapping used by SOAtest:
The first column in each table is an identifier for object instances. An object may be referenced by the table name followed by a space, followed by the object identifier. Identifier column need not necessarily be row numbers, so long as the identifier values are unique within each table.
Field values of non-primitive classes are generally specified through object references as described above. However, the extra level of indirection is unnecessary and cumbersome for values of primitive types. To accommodate an abbreviated form, a built-in support is included for inlining commonly used types with well-defined string representations. An empty cell in a reference column is interpreted as the null value. An empty cell for a value column is interpreted as an empty string.
In order to support variable sized collections, a collection table is introduced. A collection table has a single reference column. An object in the collection is referenced by the table name followed by a space, followed by the object identifier.
As an example, let us consider an object graph with CreditCardDO
as a root. CreditCardDO
contains instances of PersonDO
and AddressDO
and a Vector of ActivityDO
type objects.
public class CreditCardDO extends PaymentMethodDO implements Serializable { protected String ccNumber; protected Date expirationDate; protected PersonDO ccHolder; protected AddressDO billingAddress; protected Vector recentActivity = new Vector(); // set…()/get…() methods omitted } public class PaymentMethodDO implements Serializable { protected String bankName; // set…()/get…() methods omitted } public class AddressDO implements Serializable { protected String streetAddress; protected String city; protected int zipCode; protected String state; // set…()/get…() methods omitted } public class PersonDO implements Serializable { protected String firstName; protected String lastName; // set…()/get…() methods omitted } public class ActivityDO implements Serializable { private float amount; private String description; // set…()/get…() methods omitted } |
The following tables illustrate how the above object graph example can be represented in tabular format:
Table CreditCardDO.csv
soatest.examples.CreditCardDO | bankName | billingAddress ref | ccHolder ref | ccNumber | expirationDate | recentActivityref |
---|---|---|---|---|---|---|
1 | SampleBank | AddressDO 1 | PersonDO 1 | 1234123412341 234 | 8/31/2005 | RecentActivities-1 |
Table AddressDO.csv
soatest.examples.AddressDO | city | state | streetAddress | zipCode |
---|---|---|---|---|
1 | Los Angeles | CA | 101 E. Huntington Dr. | 91016 |
Table PersonDO.csv
soatest.examples.PersonDO | firstName | lastName |
---|---|---|
1 | Donald | Duck |
Table ActivityDO.csv
soatest.examples.ActivityDO | amount | description |
---|---|---|
soatest.examples.ActivityDO | amount | description |
1 | 10 | 10 Charge-10 |
2 | 20 | 20 Charge-20 |
3 | 30 | 30 Charge-30 |
4 | 40 | 40 Charge-40 |
5 | 50 | 50 Charge-50 |
6 | 60 | 60 Charge-60 |
7 | 70 | 70 Charge-70 |
8 | 80 | 80 Charge-80 |
9 | 90 | 90 Charge-90 |
10 | 100 | 100 Charge-100 |
Table RecentActivities-1.csv
ActivityDO ref |
---|
ActivityDO 1 |
ActivityDO 2 |
ActivityDO 3 |