When you test a map that contains a relationship transformation, you need to provide the following information in addition to the test data:
Part of a map's execution context includes a calling context. Many of the relationship methods in the Mapping API use this calling context to determine what action to take during the mapping. For this reason, if you are testing a relationship attribute in a map, you usually must specify the appropriate calling context for the transformation.
When you test the SERVICE_CALL_RESPONSE calling context for an identity relationship, you need to specify the maps generic business object so that the test run can locate the generic key value in the relationship.
You specify this information in the Source Testing Data pane of the Test tab.
Tip: If the width of the Source Testing Data pane is not enough to let you see the complete menu options of the Calling Context combo box, you can expand the size of this area by putting the cursor over the right-hand boundary until you see the following symbol <-||-> and drag the boundary to the right.
If you are testing Relationships, select the appropriate generic object from the list of business objects, select Calling Context, and set the ObjectEventIds for the parent and child objects that match the ones you already set in the Test Data screen. The calling context you need to provide and whether you need to specify a generic business object depend on the type of relationship you are testing. This section provides information on the following:
To test point-to-point mapping (from Application 1 to Application 2) for an identity relationship you use three maps:
Figure 39 shows an example of a point-to-point communication of customer data between a Clarify application and an SAP application. If each application uses a unique key value to identify customers, these three business objects can be related with an identity relationship. Therefore, each map includes a cross-reference transformation rule. As each of these maps executes, these relationship methods access the calling context to determine the actions to take.
Figure 39. Maps involved in point-to-point
testing of an identity relationship
To test the Create verb, you need to verify that a new application-specific key value in Application 1 (Clarify application in Figure 39) causes a new generic key value to be added for the generic business object and a new application-specific key value in Application 2 (SAP application in Figure 39). Therefore, testing involves three steps:
Table 17. Testing the App1-to-Generic map for an identity relationship
To test an identify relationship in the outbound Generic_to_App2 map, you must provide the generic key value in your source Test Data. You might want to do either of the following, but they are both wrong:
In both cases, Map Designer Express generates the RelationshipRuntimeException or NullPointerException. The error occurs because the generic key value has to be in the system for the SERVICE_CALL_REQUEST to work properly, and the relationship table is not the only place the generic key value is stored.
The correct solution is to first run an inbound EVENT_DELIVERY (or ACCESS_REQUEST) map that uses the same identity relationship (as described in step 1). Follow the steps in Table 18 to test the outbound Generic_to_App2 map.
Table 18. Testing the generic-to-app2 map for an identity relationship
When the calling context is SERVICE_CALL_RESPONSE, an identity relationship must cross-reference the ID in the application-specific business object to the ID in the generic business object. Therefore, for this test, you must specify the generic business object definition. Follow the steps in Table 19..
Table 19. Testing the App2_to_Generic map for an identity relationship
To set up test run | To verify test run |
---|---|
|
7. Read the
resulting generic key value in the destination business object,
which should be the same value you entered in the generic source
business object. 8. You can use Relationship Manager to verify that the correct application-specific key values are associated with this generic key value for this identity relationship. For more information on Relationship Manager, see the User Guide for WebSphere Business Integration Express and Express Plus for Item Synchronization. |
Testing for other verbs involves similar steps. For more detailed information on the actions of relationship methods for an identity relationship, see Implementing relationships.
To test point-to-point mapping (from Application 1 to Application 2) for a lookup relationship you use two maps:
Figure 40 shows an example of a point-to-point communication of customer data between a Clarify application and an SAP application. If each application uses a special static code to identify geographic states, these three business objects can be related with a lookup relationship. Therefore, each map includes Custom transformations that do static lookups. For more information, see the "Static Lookup" activity example in "Example 3 of using the Activity Editor". As each of these maps executes, these relationship methods access the calling context to determine the actions to take.
Figure 40. Maps involved in point-to-point
testing of a lookup relationship
To test the Create verb, you need to verify that an existing application-specific lookup value in Application 1 (Clarify application in Figure 40) causes the associated generic lookup value to be added to the generic business object and the associated application-specific lookup value in Application 2 (SAP application in Figure 40) to be added to its business object. Therefore, testing involves two steps:
Table 20. Testing the App1-to-Generic map for a lookup relationship
Table 21. Testing the Generic-to-App2 Map for a lookup relationship