Create and Manage Publish and Table Actions

The CA TDM Portal lets you create Publish and Table actions, that you can execute before or after data generation.
tdm49
The CA TDM Portal lets you create
Publish
and
Table
actions, that you can execute before or after data generation.
  • Pre-publish actions
    are actions that you want to execute before you perform the publish. For example, by creating a pre-publish action, you can clear down some specified columns.
  • Post-publish actions
    are actions that you want to execute after you perform the publish. For example, by creating a post-publish action you can update some columns using SQL.
You cannot create, edit or execute Actions of type
HOST
or
WORKFLOW
from within TDM Portal in Docker. For more information, see TDM Portal REST ActionService container.
Enable HOST Actions
HOST actions can manipulate files and folders and execute commands with system level privileges on the CA TDM server. When users try to run a job that contains a HOST action, the back-end returns the following error by default:
HOST actions are not enabled. Contact your admin.
To allow authorized CA TDM users to run HOST actions, the CA TDM administrator must enable this feature.
  1. Navigate to the directory where you installed the CA TDM Portal, and open the "conf/" sub-directory.
  2. Locate and open the
    application.properties
    file in a text editor.
  3. Enable the execution of host actions by setting the following flag to true.
    EnableHostActions={true|false}
    Default:
    false
    • false
      — specifies that users cannot run HOST actions. Users can still create HOST actions from the CA TDM Portal, and are still able to see HOST actions created for the job in the list.
    • true
      — specifies that users can run HOST actions with system level privileges.
  4. Restart the CA TDM service.
Create an Action
  1. Select a project and version from the Project drop-down list available in the portal header. Optionally, click the gear icon (next to Project drop-down in the portal header) to search for a specific project.
    If you want to create a new project, see Create and Edit Projects.
  2. Click
    Generators
    in the left pane.
    The
    Generators
    page opens and lists the existing generators created for the selected project and version.
    If you want to create a new generator, see Create Data Generator.
  3. Click the generator for which you want to create publish actions.
    The
    Generator Details
    page opens.
  4. Click the
    Actions
    button.
    The
    Actions
    page opens.
  5. Select an action type from the
    Actions
    drop-down. The following options are available:
    • Publish
      Executes the action every time you perform publish data generation.
    • Table
      Executes the action only when the specified used table is associated in publish data generation.
  6. Click the
    Create Publish Action
    or
    Create Table Action
    button based on the action type you selected.
    The
    New Publish Action
    or
    New Table Action
    page opens.
  7. Enter the following information:
    • Name
      Defines a name for the action that you want to create.
    • Description
      Defines a brief description of the action that you want to create.
  8. Select the
    Code Type
    . The following options are available:
    • Host
      To run an actual program on the TDM server.
    • Javelin
      To create and execute Javelin actions for a generator in the CA TDM Portal. For more information, see Using Workflows in CA TDM Portal.
    • SQL
      To execute an SQL statement in the environment into which you publish data.
    • REST
      To perform a call to a REST API endpoint.
  9. (
    Table
    Action only) From the Table drop-down list, select the table on which you want to perform the Action.
  10. (Code Type
    Host
    only) Specify the following fields:
    • Command
      Defines the command to execute on the host machine as system user.
      Example: This command shuts down the computer after publishing:
      cmd /c shutdown -s
    • Wait for Completion
      Specifies whether you want to run the action of type Host synchronously. If so, enable this option and specify a value in the
      Timeout
      field.
    • Execution Timeout
      Specifies the time (in seconds) for which the Portal waits for the completion of the action. If the action does not complete before the timeout limit, it is terminated and a failure is returned for the action. If the value of timeout field is greater than 0, the action is considered as synchronous. For all other cases (including not providing the value), the action is considered as asynchronous.
    • Success Required
      Specifies whether invoking the program is required or optional. Select this check-box, if invoking the specified program is mandatory. If invoking the program fails, the publish will not be completed.
  11. (Code Type
    SQL
    only) Specify the following fields:
    • DB Connection
      Specifies the Database on which you want to execute the SQL. Select a database from the drop-down list.
    • Use
      You can use either Stored SQL or Direct Code to execute the publish action. Specify one of the following as required:
      • Stored SQL
        Select the stored SQL from the drop-down list.
      • Direct Code
        Enter the code required to execute the SQL. Separate multiple queries with a semicolon.
        Example:
        delete from [dbo].[BLOB_TABLE_9]; delete from [dbo].[BLOB_TABLE_20]; delete from [dbo].[BLOB_TABLE_8];
    • Success Required
      Specifies whether successful execution of the SQL is required. If you select this check-box, and execution of the SQL fails, the publish is not completed.
    • Enable Concurrency
      Specifies whether each query runs in its own thread when more than one query is inserted in the publish action. All queries run concurrently up to a maximum of 10 threads. When the number of queries to run is larger than the maximum number of threads, the remaining queries are put in a queue waiting for a thread to be available.
      Note: The Test Data Engineer can configure the maximum number of threads through the
      tdmweb.publish.action.query.maxthreads
      entry in the application.properties file.
    • Success Criteria
      Specifies the criteria to meet for successful execution of SQL. Select one of the following two options and specify the criteria as required:
      • Results
      • Row Count
    • Execution: Wait for Completion
      Specifies whether to terminate run-away queries if the query exceeds the timeout value. If more than one query is inserted in the publish action, the behavior depends on the concurrency setting:
      • If Concurrency is enabled, any query is terminated when it takes longer to run than the timeout value.
      • If Concurrency is disabled, the timeout value applies to the cumulative execution time of all queries. When the timeout is exceeded, the currently executing query is terminated; all remaining queries that have not yet started executing do not start.
      • Timeout
        Specifies the time (in seconds) for which the Portal waits for the completion of the action before it terminates the queries.
  12. (Code Type
    REST
    only) Specify the following:
    • REST Action URL
      Full REST API URL. For example: http://my.action.com
    • Action Secret
      This value acts as a security measure for the target API URL, and its contents are concealed as you type. Check what security protection is in place on the target API; if there is no such security protection on the target API, this value is not used.
      This value appears in the REST API body that TDM generates as a
      hashed
      value using the hashing algorithm sha-256.
      For example, if you enter 'marmite' in the
      Action Secret
      field, the value of parameter
      secret
      in the API body is
      7362DEDB2123ABABBD1446A395A7235DE3DFADF91F173961DABDE8FECFDBFC1C
      .
    • Variables for the Action
      Enter any substitution variables you want to use in your TDM commands, separated with commas. You can also define (or redefine) variables with the syntax varName="value".
      For example:
      CDATE, my_variable="red",  client_name,  another_variable
      Enter all variables
      without
      the tilda (~) symbol before and after.
      These variables appear in the parameters section of the API body that TDM generates, with their associated default values. For more information, see Create and Manage Variables.
    • Identity Delegation
      Choose whether the user that performs the Action is you, or a
      Custom User
      . For a Custom User, enter User Name and Password fields.
  13. Select the Execute Action to determine whether the action is a Pre-Publish or Post-Publish action. Following are the available options:
    • Before (Pre-Publish)
      Specifies the action to complete before the publishing starts.
    • After (Post-Publish)
      Specifies the action to perform after the publishing completes.
  14. Click
    Save
    .
    The publish action is successfully created. The created publish actions for executing Before and After are added to Pre Publish Actions and Post Publish Actions respectively on the Actions page.
    Repeat the above steps to create more publish actions.
Re-order Actions
  1. Select a project and version from the Project drop-down list available in the portal header. Optionally, click the gear icon (next to Project drop-down in the portal header) to search for a specific project.
  2. Click Generators in the left pane.
    The Generators page opens and lists the existing generators created for the selected project and version.
  3. Click the generator to see the existing actions.
    The generator details page opens.
  4. Select Publish or Table from Actions drop-down to see the respective type of existing actions.
    The Actions page opens and lists the Publish Actions or Table Actions based on the action type you selected.
  5. Identify the actions that you want to re-order and click the upward arrow or the downward arrow to move the respective action up or down. The actions are executed in the order they appear in the list.
Execute an Action
  1. Select a project and version from the
    Project
    drop-down list available in the portal header. Optionally, click the gear icon (next to Project drop-down in the portal header) to search for a specific project.
  2. Click
    Generators
    in the left pane.
    The
    Generators
    page opens and lists the existing generators created for the selected project and version.
  3. Click the generator to see the existing publish actions.
    The
    Generator Details
    page opens.
  4. Select
    Publish
    or
    Table
    from the
    Actions
    drop-down to see the respective type of existing actions.
    The Actions page opens and lists the Publish Actions or Table Actions based on the action type you selected.
    For the Publish actions of the type Host and SQL, the
    Wait for Completion
    and
    Timeout
    options also apply. Additionally, you can specify a different value in the
    Timeout
    field and execute your action using that value. This way you can execute your publish actions with different timeout values. You can then edit your action if you want to change the execution timeout value based on your testing. The new timeout value is not persistent; that is, you cannot save this value to override the original value, which you specified at the time of creating your action.
  5. Identify and click the forward arrow (>) in the row that corresponds to the action that you want to execute.
    The Portal executes the respective Action and shows a message with the success or failure information.
Edit an Action
  1. Select a project and version from the Project drop-down list available in the portal header. Optionally, click the gear icon (next to Project drop-down in the portal header) to search for a specific project.
  2. Click
    Generators
    in the left pane.
    The
    Generators
    page opens and lists the existing generators created for the selected project and version.
  3. Click the generator to see the existing publish actions.
    The
    Generator Details
    page opens.
  4. Select
    Publish
    or
    Table
    from the Actions drop-down to see the respective type of existing actions.
    The
    Actions
    page opens and lists the existing Publish Actions or Table Actions based on the action type you selected.
  5. Identify and click the action that you want to edit.
    The Edit Publish Action or Table Action page opens based on the action type.
  6. Modify the details as necessary and click
    Save
    . You can edit all the details except the Code Type.
Delete an Action
  1. Select a project and version from the
    Project
    drop-down list available in the portal header. Optionally, click the gear icon (next to Project drop-down in the portal header) to search for a specific project.
  2. Click
    Generators
    in the left pane.
    The
    Generators
    page opens and lists the existing generators created for the selected project and version.
  3. Click the generator to see the existing publish actions.
    The
    Generator Details
    page opens.
  4. Select
    Publish
    or
    Table
    from the Actions drop-down to see the respective type of existing actions.
    The
    Actions
    page opens and lists the existing Publish Actions or Table Actions based on the action type you selected.
  5. Identify and click the cross icon (X) in the row that corresponds to the action that you want to delete.
    A confirmation dialog opens.
  6. Click
    Delete
    .
    A message confirms the successful deletion of the action.
  7. Review the actions list to verify that the deleted action is no longer available in the table.