Test Data Manager

TDM Data generation through Jenkins 

10-25-2018 08:54 PM

This is a Jenkins pipeline script for data generation. The script covers the following scenarios:

 

Scenario 1: Publishing through an existing generator

Services used:

publish data:

POST /TDMJobService/api/ca/v1/jobs

request body (publish_job.json) elements marked ** are variable inputs: 

 {
   "name":"test api publisher",                               //**publish name
   "description":"Publish to using api",                      //**publish description
   "projectId":2451,                                          //**project id
   "versionId":2452,                                          //**version id
   "type":"PUBLISHJOB",                                       //always PUBLISHJOB
   "origin":"generation",                                     //always generation
   "scheduledTime":1464952420271,                             //**java.util.date milliseconds
   "jobs":[],
   "parameters":{
      "generatorId":2457,                                     //**generator id from portal or create generator response
      "jobType":"PUBLISH",                                    //always PUBLISH
      "title":"Publish to PO using PO_Generator",             //**description for output
      "publishTo":"TGT",                                      //TGT for target connection
      "target":"TRAVEL_E",                                    //**target schema name
      "dataTargetProfile":"travel_e",                         //**connection profile name
      "repeatCount":1,                                        //**variable
   }
}

 

Scenario 2: Publishing through a new generator

Services used:

create generator: 

POST /TDMGeneratorService/api/ca/v1/generators

parameters: projectId, versionId

request body (new_generator.json):

{
   "description": "new_generator",
   "name": "new_generator",
   "projectId": 4945,
   "versionId": 4946
}

response body:

{
     "name": "new_generator",
     "description": "new_generator",
     "projectId": 4945,
     "versionId": 4946,
     "generatorId": 2501,                                       //used in subsequent steps
     "created": "2018-06-27T21:21:31+0000",
     "updated": "",
     "comment": null,
     "onDemand": null,
     "type": "N",
     "projectName": null,
     "versionName": null,
     "parentId": 2461
}

 

get registered tables:

GET /TDMGeneratorService/api/ca/v1/generators/{generatorId}/tables                        //generatorId from previous step

parameters: projectId, versionId

response body:

"tables": [
        {
            "tableId": 831,                                      //used in following step
            "name": "ACCOUNT_PERIODS",
            "order": 1,
            "schema": "TRAVEL",
            "rowCount": 0,
            "columns": []
        },
        {
             "tableId": 832,
             "name": "ADDRESS",
             "order": 2,
             "schema": "TRAVEL",
             "rowCount": 0,
             "columns": []
         }]

 

add row definition:

POST /TDMGeneratorService/api/ca/v1/generators/{generatorId}/tables/{tableId}/definitionRows       //generatorId and tableId from previous steps

parameters: projectId, versionId

request body (datapainter.json):

{
       "definitions": [
         {
           "columnName": "CARD_ID",
           "columnValue": "~NEXT~"
         },
         {
           "columnName": "CARD_NUMBER",
           "columnValue": "@randlov(0,@seedlist(Credit Card)@)@"
         },
         {
           "columnName": "TYPE",
           "columnValue": "VI"
         },
         {
           "columnName": "EXPIRATION_DATE",
           "columnValue": "@addyears(~SDATE~,3)@"
         },
         {
           "columnName": "PEO_ID",
           "columnValue": "@randlov(0,@sqllist(Porders_sql,select person_id from persons)@)@"
         }
       ]
     }

Statistics
0 Favorited
1 Views
4 Files
0 Shares
0 Downloads
Attachment(s)
zip file
jenkins_data_gen_script.groovy.zip   1K   1 version
Uploaded - 05-29-2019
zip file
datapainter.json.zip   360B   1 version
Uploaded - 05-29-2019
zip file
new_generator.json.zip   223B   1 version
Uploaded - 05-29-2019
zip file
publish_job.json.zip   400B   1 version
Uploaded - 05-29-2019

Tags and Keywords

Comments

12-11-2018 04:15 AM

Hello Kevin Ng, 

 

If I wanted to publish data in an XML file, how could I do it for scenario 1?

 

Your help please

 

Greetings.

Felipe.

Related Entries and Links

No Related Resource entered.