The following examples are based on the standard Java classes for complex objects. We have used classes from the demo server included with DevTest that are easy to reproduce in your environment.
Complex DTO Object Scenario 1
A complex DTO Object, com.itko.examples.dto.Customer, is loaded in the Complex Object Editor using a Dynamic Java Execution step.
This DTO is complex because its properties are not all simple values, such as primitives or strings. However, because of its DTO structure, we can still use Simple Mode.
Each of the properties must be given values before the Customer object can be used.
An array of Address objects
An Address object
A Java Date object
An array of integers
This holds true for all the properties that are listed in the Object Call tree.
The input parameters for the Data object are displayed and can be given values.
The Customer object is now fully specified and can be used in your test case.
Complex DTO Object Scenario 2
The last scenario shows an example that builds on the last three scenarios.
This DTO, com.itko.examples.dto.OrderDTO, has a Customer object as one of its properties. This scenario shows how easy it is to build a Customer object in simple mode without calling any setter methods.
The OrderDTO object was loaded in COE using a Dynamic Java Execution step.
Again we can use Simple Mode for the OrderDTO object.
Follow these steps:
The Customer row expands to expose its properties.
All the properties can be edited in this window. The Integer and String properties can be added in the Value column. The remaining properties expand to show their properties when you clear the Null box for the property. If the property is a single object, it expands to expose its properties. If it is an array or collection, you can add the appropriate number of elements. This graphic shows a snapshot of the editing process.
The locations property has two elements; the types property has three elements. The poAddr object is of type Address, and is expanded exposing simple string properties.
Copyright © 2014 CA Technologies.
All rights reserved.
|
|