Testing Default Service Implementations

When the C++ Expert generates Framework Class files, it also generates a a make file that can be used to build that client and server. The name of the generated make file is based on the name of the Contract Repository module and the current platform:

Table 3-2 Generated make file Naming and Use

Platform File name Sample Usage

UNIX

Module1.mk

make -f Module1.mk

Windows NT

Module1.mak

If you are using Microsoft Visual C++:

If the Generate Server Test Client and Generate Service Test Logic checkboxes are enabled on the Generate Settings window, a command-line test client and service test logic are also generated.

When Generate Service Test Logic checkbox is enabled, the C++ Expert generates default test logic for all services within a server that relate to a module in the Contract Repository. This test logic will log all the service input arguments to the BEA TUXEDO userlog file, assign static values to all output arguments (based on their type) and return an appropriate reply.

When the Generate Server Test Client checkbox is enabled, the C++ Expert generates a command-line test client you can use to exercise all the services within the server. When the test client is run, it will perform these actions for each service:

  1. Prompt the user to enter values for each input argument.

  2. Call the service, using those arguments.

  3. Retrieve any output arguments.

  4. Display the value of the retrieved output arguments.


 

Configuring the Generated Test Client and Server

You can use the Configuration Expert to generate a BEA TUXEDO configuration file (a ubbconfig file) with information necessary for BEA TUXEDO to boot the servers. Once the servers are running, you can use the command-line client to test the generated default logic for the services.
 

Running the Generated Test Client

Once you have built, configured and booted the application, you are ready to run test client. The test client is a command-line client that prompts you for input, accesses the service and returns the results of the call to the service.

To run the test client:

  1. At the command line, change directories to the Project Root directory. (For example, \TUXBldr\CPPExpert\output\BANKAPP\)

  2. Enter Module1_tst at the command line prompt, where Module1 is the name of the module. For example, BANKAPP_tst.

    The following code listing shows the output you can expect to see when you run the test client. (Sample user input is shown in bold.)

    Listing 3-1 Example of Running the Test Client
    C:\TUXBldr\CPPExpert\output\Bankapp>bankapp_tst

    Testing Service Implementation Class: Teller and service: DEPOSIT
    << Enter the variable ( long ACCOUNT_ID), value:
    100

    << Enter the variable ( string SAMOUNT), value:
    100.09

    << Output variable (string SBALANCE), value = STRING VALUE
    << Output variable (string STATLIN), value = STRING VALUE

    Testing Interface: Teller and service: INQUIRY
    << Enter the variable ( long ACCOUNT_ID), value:
    102

    << Output variable (string SBALANCE), value = STRING VALUE

    Testing Interface: Teller and service: WITHDRAWAL
    << Enter the variable ( long ACCOUNT_ID), value:
    102

    << Enter the variable ( string SAMOUNT), value:
    100.09

    << Output variable (string SBALANCE), value = STRING VALUE
    << Output variable (string STATLIN), value = STRING VALUE

    Testing Interface: Backoffice and service: OPEN_ACCT
    << Enter the variable ( long BRANCH_ID), value:
    20

    << Enter the variable ( string SAMOUNT), value:
    100.09

    << Enter the variable ( char ACCT_TYPE), value:
    C

    << Enter the variable ( string LAST_NAME), value:
    LASTNAME

    << Enter the variable ( string FIRST_NAME), value:
    FIRSTNAME

    << Enter the variable ( char MID_INIT), value:
    M

    << Enter the variable ( string SSN), value:
    666778888

    << Enter the variable ( string ADDRESS), value:
    def xyz

    << Enter the variable ( string PHONE), value:
    1112223333

    << Enter the variable ( char OPEN_CR), value:
    S

    << Output variable (long ACCOUNT_ID), value = 99999999
    << Output variable (string SBALANCE), value = STRING VALUE
    << Output variable (string STATLIN), value = STRING VALUE

    Testing Interface: Backoffice and service: CLOSE_ACCT
    << Enter the variable ( long ACCOUNT_ID), value:
    100

    << Output variable (string SBALANCE), value = STRING VALUE
    << Output variable (string STATLIN), value = STRING VALUE

    Testing Interface: Transfer and service: TRANSFER
    << Enter the variable ( long DEBIT_ACCOUNT_ID), value:
    100

    << Enter the variable ( long CREDIT_ACCOUNT_ID), value: