XX1 Ghost Adapter Configuration
The XX1 Ghost adapter allows you to simulate host or data base adapter requests and responses using flat XML text files or XXTraceConsole trace files (.xtr).
XX1 ghost configuration is held in ghostcfg.xml or as named in the xxscfg.xml adapter entry. The name of the runtime library is xxghost and loaded as follows through the main configuration:
<provider>
<adapter name="MyHost" lib="xxghost" config="ghostcfg.xml"/>
Configuration Parameter
Node | Description | Default (if not specified) |
---|---|---|
DataFolder | Specifies directory where ghost data files reside. | |
MinResponseTime | Optional. Simulate a host response delay. Specify minimum value in milliseconds. | 0ms |
MaxResponseTime | Optional. Simulate a host response delay. Specify maximum value in milliseconds. If this value is greater than MinResponseTime, a random value between MinResponseTime and MaxResponseTime is used. | MinResponseTime value |
Example:
<Ghost>
<DataFolder>ghost</DataFolder>
<MinResponseTime>1000</MinResponseTime>
<MaxResponseTime>5000</MaxResponseTime>
</Ghost>
Simulation XSL file
The ghost adapter will look in the directory specified in DataFolder for a simulation XSL with filename as follows: [provider name]_[request message]_sim.xsl
provider name = Name of provider specified in TC
request message = Root node of client request XML
Examples:
- SabreWS_FareSearchRQ_sim.xsl
- AmadeusWS_PNRCreateRQ_sim.xsl
- GalileoWS_FlightPriceRQ_sim.xsl
The ghost adapter will then execute the XSL using the actual client request XML as input for the XSL transformation. The XSL can be written to perform one of two actions:
- Play a XXTraceConsole trace file that contains multiple host transactions within a session or
- output a single native host response directly.
Using a Trace file
Connect the XXTraceConsole to the XX1 server with a live host connection and take a trace from one client transaction. Save the trace as .xtr trace file and store the file in the ghost host data directory. Note that each trace file must contain one complete client transaction only.
Create the simulation XSL and code for the XSL transformation output to have a single <file>
XML element with the name of the trace file: <file>Sabre_FlightPriceRQ.xtr</file>
Example: Sabre_FlightPriceRQ_sim.xsl:
<xsl:stylesheet version="1.0">
<xsl:template match="/">
<xsl:apply-templates select="FlightPriceRQ"/>
</xsl:template>
<xsl:template match="FlightPriceRQ">
<file>Sabre_FlightPriceRQ.xtr</file>
</xsl:template>
</xsl:stylesheet>
You can evaluate the input request elements in the XSL to result in a different filename depending on input values.
Creating a Single Host Response Directly
Create the simulation XSL and code for the output of the XSL transformation to be the native host response. You can either hard-code the response in the XSL or code for the output to have a single <file>
XML element with a name of a plain XML text file containing the desired host response.
Example: Amadeus_AirAvailabilityRQ_sim.xsl
<xsl:stylesheet version="1.0">
<xsl:template match="/">
<xsl:apply-templates select="AirAvailabilityRQ"/>
</xsl:template>
<xsl:template match="AirAvailabilityRQ">
<file>PoweredAir_MultiAvailability.xml</file>
</xsl:template>
</xsl:stylesheet>