06.06 - Build-in shortcuts (macros)


Contents

  1. 1 # EXECUTE_SQL {file} ON {database} AS {result}
  2. 2 # EXECUTE_SQL_SCRIPT {file} ON {database} AS {result}
  3. 3 # EXECUTE_SQL_SCRIPT_BY_REMOVING_SEPARATOR {file} ON {database} AS {result}
  4. 4 # INSERT_DBUNIT {dataset} INTO {database}
  5. 5 # INSERT_DBUNIT {dataset} INTO {database} WITH CONFIG {config}
  6. 6 # INSERT_DBUNIT {dataset} INTO {database} USING {ppkfilter}
  7. 7 # INSERT_DBUNIT {dataset} INTO {database} WITH CONFIG {config} USING {ppkfilter}
  8. 8 # DELETE_DBUNIT {dataset} FROM {database}
  9. 9 # DELETE_DBUNIT {dataset} FROM {database} WITH CONFIG {config}
  10. 10 # DELETE_DBUNIT {dataset} FROM {database} USING {ppkfilter}
  11. 11 # DELETE_ALL_DBUNIT {dataset} FROM {database}
  12. 12 # DELETE_ALL_DBUNIT {dataset} FROM {database} WITH CONFIG {config}
  13. 13 # REFRESH_DBUNIT {dataset} INTO {database}
  14. 14 # REFRESH_DBUNIT {dataset} INTO {database} WITH CONFIG {config}
  15. 15 # REFRESH_DBUNIT {dataset} INTO {database} USING {ppkfilter}
  16. 16 # REFRESH_DBUNIT {dataset} INTO {database} WITH CONFIG {config} USING {ppkfilter}
  17. 17 # UPDATE_DBUNIT {dataset} INTO {database}
  18. 18 # UPDATE_DBUNIT {dataset} INTO {database} WITH CONFIG {config}
  19. 19 # UPDATE_DBUNIT {dataset} INTO {database} USING {ppkfilter}
  20. 20 # UPDATE_DBUNIT {dataset} INTO {database} WITH CONFIG {config} USING {ppkfilter}
  21. 21 # ASSERT_DBUNIT TARGET {database} CONTAINS {dataset}
  22. 22 # ASSERT_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config}
  23. 23 # ASSERT_DBUNIT TARGET {database} CONTAINS {dataset} WITH FILTER {filter}
  24. 24 # ASSERT_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config} AND FILTER {filter}
  25. 25 # ASSERT_DBUNIT TARGET {database} EQUALS {dataset}
  26. 26 # ASSERT_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config}
  27. 27 # ASSERT_DBUNIT TARGET {database} EQUALS {dataset} WITH FILTER {filter}
  28. 28 # ASSERT_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config} AND FILTER {filter}
  29. 29 # VERIFY_DBUNIT TARGET {database} CONTAINS {dataset}
  30. 30 # VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config}
  31. 31 # VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH FILTER {filter}
  32. 32 # VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config} AND FILTER {filter}
  33. 33 # VERIFY_DBUNIT TARGET {database} EQUALS {dataset}
  34. 34 # VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config}
  35. 35 # VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH FILTER {filter}
  36. 36 # VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config} AND FILTER {filter}

# EXECUTE_SQL {file} ON {database} AS {result}

What: This macro will load and execute an SQL query against the database, then the result will be returned under the name you typed for the last parameter. 

# EXECUTE_SQL {file} ON {database} AS {result}
  =>
LOAD {file} AS __temp{%%rand1}.file

CONVERT __temp{%%rand1}.file TO file(param.relativedate) AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO query.sql(query) AS __temp_{%%rand3}.query
EXECUTE execute WITH __temp_{%%rand3}.query ON {database} AS {result}

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {file}: A SQL query ('.sql')
  • {result}: The name of the resource which will contain the result of the SQL query(Resource of category result.sql).

Remark: The file designed by {file} must respect the same rules than a file which would serve to create a TA resource of category query.sql via the converter of category query (From file to query.shell)

Example:

# EXECUTE_SQL path/to/query1.sql ON my_database AS result



# EXECUTE_SQL_SCRIPT {file} ON {database} AS {result}

What: This macro will load and execute an SQL script against the database, then the result will be returned under the name you typed for the last parameter. 

# EXECUTE_SQL_SCRIPT {file} ON {database} AS {result}
=>
LOAD {file} AS __temp{%%rand1}.file

CONVERT __temp{%%rand1}.file TO file(param.relativedate) AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO script.sql AS __temp_{%%rand3}.script
EXECUTE execute WITH __temp_{%%rand3}.script ON {database} AS {result}

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {file}: A SQL script
  • {result}: a free identifier for the resulting. As the 'execute' command with a sql script return an empty resource, this result resource will also be empty.

Remark: The file designed by {file} must respect the same rules than a file which would serve to create a TA resource of category script.sql via the converter of category script (From file to script.sql)

Example:

# EXECUTE_SQL_SCRIPT path/to/my_script.sql ON my_database AS result

# EXECUTE_SQL_SCRIPT_BY_REMOVING_SEPARATOR {file} ON {database} AS {result}

What: This macro will load and execute an SQL script against the database, then the result will be returned under the name you typed for the last parameter. The separator (";") at the end of each SQL query of the script will be removed.

# EXECUTE_SQL_SCRIPT_BY_REMOVING_SEPARATOR {file} ON {database} AS {result}
=>
LOAD {file} AS __temp{%%rand1}.file

CONVERT __temp{%%rand1}.file TO file(param.relativedate) AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO script.sql AS __temp_{%%rand3}.script
EXECUTE execute WITH __temp_{%%rand3}.script ON {database} USING $(keep.separator:false) AS {result}

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {file}: A SQL script
  • {result}: a free identifier for the resulting. As the 'execute' command with a sql script return an empty resource, this result resource will also be empty.

Remark: The file designed by {file} must respect the same rules than a file which would serve to create a TA resource of category script.sql via the converter of category script (From file to script.sql)

Example:

# EXECUTE_SQL_SCRIPT_BY_REMOVING_SEPARATOR path/to/my_script.sql ON my_database AS result


# INSERT_DBUNIT {dataset} INTO {database}

What: This macro will insert all the data listed in the 'dataset file' into the 'database'.
# INSERT_DBUNIT {dataset} INTO {database}
=>
LOAD {dataset} AS __temp{%%rand1}.file

CONVERT __temp{%%rand1}.file TO file(param.relativedate) AS __temp_{%%rand2}.file
CONVERT __temp_{%%rand2}.file TO xml(structured) AS __temp_{%%rand3}.xml
CONVERT __temp_{%%rand3}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand4}.dbu

EXECUTE insert WITH __temp_{%%rand4}.dbu ON {database} USING $(operation:insert) AS __temp_{%%rand5}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file

Remark: The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).

Example:

# INSERT_DBUNIT path/to/dataset.xml INTO my_database



# INSERT_DBUNIT {dataset} INTO {database} WITH CONFIG {config}

What: This macro will insert all the data listed in the 'dataset file' into the 'database' using a DbUnit configuration file.

# INSERT_DBUNIT {dataset} INTO {database} WITH CONFIG {config}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

LOAD {dataset} AS __temp{%%rand3}.file

CONVERT __temp{%%rand3}.file TO file(param.relativedate) AS __temp_{%%rand4}.file
CONVERT __temp_{%%rand4}.file TO xml(structured) AS __temp_{%%rand5}.xml
CONVERT __temp_{%%rand5}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand6}.dbu

EXECUTE insert WITH __temp_{%%rand6}.dbu ON {database} USING $(operation:insert),__temp{config}{%%rand2}.conf AS __temp_{%%rand7}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')

Remarks:

  1. The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).
  2. The file designed by {config} must respect the same rules than a file which would serve to create a TA resource of category conf.dbunit via the converter of category dataset (From file to conf.dbunit).

Example:

# INSERT_DBUNIT path/to/dataset.xml INTO my_database WITH CONFIG  path/to/my_config_dbunit.properties



# INSERT_DBUNIT {dataset} INTO {database} USING {ppkfilter}

What: This macro will insert all datas listed in the 'dataset file' into the 'database' using a DbUnit filter.
# INSERT_DBUNIT {dataset} INTO {database} USING {ppkfilter}
=>
LOAD {dataset} AS __temp{%%rand1}.file
CONVERT __temp{%%rand1}.file TO file(param.relativedate) AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO xml(structured) AS __temp{%%rand3}.xml
CONVERT __temp{%%rand3}.xml TO dataset.dbunit(dataset) AS __temp{%%rand4}.dbu

LOAD {ppkfilter} AS __temp{%%rand5}.file
CONVERT __temp{%%rand5}.file TO properties(structured) AS __temp{%%rand6}.props
CONVERT __temp{%%rand6}.props TO conf.dbunit.ppk(from.properties) AS __temp{%%rand7}.ppk

EXECUTE insert WITH __temp{%%rand4}.dbu ON {database} USING __temp{%%rand7}.ppk,$(operation:insert) AS __temp_{%%rand8}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {ppkfilter}: A DbUnit filter referring to pseudo primary keys('.properties')

Example:

# INSERT_DBUNIT path/to/dataset.xml INTO my_database USING path/to/my_filter_dbunit.properties



# INSERT_DBUNIT {dataset} INTO {database} WITH CONFIG {config} USING {ppkfilter}

What: This macro will insert all the data listed in the 'dataset file' into the 'database' using a DbUnit configuration file and a DbUnit filter.

# INSERT_DBUNIT {dataset} INTO {database} WITH CONFIG {config} USING {ppkfilter}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

LOAD {dataset} AS __temp{%%rand3}.file
CONVERT __temp{%%rand3}.file TO file(param.relativedate) AS __temp_{%%rand4}.file
CONVERT __temp_{%%rand4}.file TO xml(structured) AS __temp_{%%rand5}.xml
CONVERT __temp_{%%rand5}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand6}.dbu

LOAD {ppkfilter} AS __temp{%%rand7}.file
CONVERT __temp{%%rand7}.file TO properties(structured) AS __temp{%%rand8}.props
CONVERT __temp{%%rand8}.props TO conf.dbunit.ppk(from.properties) AS __temp{%%rand9}.ppk

EXECUTE insert WITH __temp_{%%rand6}.dbu ON {database} USING __temp{%%rand9}.ppk,$(operation:insert),__temp{config}{%%rand2}.conf AS __temp_{%%rand10}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')
  • {ppkfilter}: A DbUnit filter referring to pseudo primary keys('.properties')

Example:

# INSERT_DBUNIT path/to/dataset.xml INTO my_database WITH CONFIG path/to/my_config_dbunit.properties USING path/to/my_filter_dbunit.properties



# DELETE_DBUNIT {dataset} FROM {database}

What: This macro will delete all the data listed in the 'dataset file' from the 'database'.

# DELETE_DBUNIT {dataset} FROM {database}
=>

LOAD {dataset} AS __temp_{%%rand1}.file

CONVERT __temp_{%%rand1}.file TO xml(structured) AS __temp_{%%rand2}.xml
CONVERT __temp_{%%rand2}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand3}.dbu

EXECUTE delete WITH __temp_{%%rand3}.dbu ON {database} USING $(operation : delete) AS __temp_{%%rand4}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file

Remark: The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).

Example:

# DELETE_DBUNIT path/to/dataset.xml FROM my_database



# DELETE_DBUNIT {dataset} FROM {database} WITH CONFIG {config}

What: This macro will delete all the data listed in the 'dataset file' from the 'database' using a DbUnit configuration file

# DELETE_DBUNIT {dataset} FROM {database} WITH CONFIG {config}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

LOAD {dataset} AS __temp_{%%rand3}.file

CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand5}.dbu

EXECUTE delete WITH __temp_{%%rand5}.dbu USING $(operation : delete),__temp{config}{%%rand2}.conf ON {database} AS __temp_{%%rand6}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')

Remarks:

  1. The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).
  2. The file designed by {config} must respect the same rules than a file which would serve to create a TA resource of category conf.dbunit via the converter of category dataset (From file to conf.dbunit).

Example:

# DELETE_DBUNIT path/to/dataset.xml FROM my_database WITH CONFIG path/to/my_config_dbunit.properties



# DELETE_DBUNIT {dataset} FROM {database} USING {ppkfilter}

What: This macro will load the specified xml dataset and delete datas listed in from the 'database' using a filter DbUnit.

# DELETE_DBUNIT {dataset} FROM {database} USING {ppkfilter}
=>

// Load and convert the dbunit dataset
LOAD {dataset} AS __{%%r1}.file
CONVERT __{%%r1}.file TO file(param.relativedate) AS __{%%r2}.file
CONVERT __{%%r2}.file TO xml(structured) AS __{%%r3}.xml
CONVERT __{%%r3}.xml TO dataset.dbunit(dataset) AS __{%%r4}.dbu

// Load and convert the pseudo primary key filter
LOAD {ppkfilter} AS __{%%r5}.file
CONVERT __{%%r5}.file TO properties(structured) AS __{%%r6}.props
CONVERT __{%%r6}.props TO conf.dbunit.ppk(from.properties) AS __{%%r7}.ppk

// Execute delete operation using the pseudo primary key filter
EXECUTE delete WITH __{%%r4}.dbu ON {database} USING __{%%r7}.ppk,$(operation : delete) AS __{%%r8}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {ppkfilter}: A DbUnit filter referring to pseudo primary keys('.properties')

Example:

# DELETE_DBUNIT path/to/dataset.xml FROM my_database USING path/to/my_filter_dbunit.properties



# DELETE_ALL_DBUNIT {dataset} FROM {database}

What: This macro will load the specified xml dataset and truncate every table listed in from the 'database'.

# DELETE_ALL_DBUNIT {dataset} FROM {database}
=>

LOAD {dataset} AS __temp_{%%rand1}.file

CONVERT __temp_{%%rand1}.file TO xml(structured) AS __temp_{%%rand2}.xml
CONVERT __temp_{%%rand2}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand3}.dbu

EXECUTE delete WITH __temp_{%%rand3}.dbu ON {database} AS __temp_{%%rand4}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file

Remark: The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).

Example:

# DELETE_ALL_DBUNIT path/to/dataset.xml FROM my_database



# DELETE_ALL_DBUNIT {dataset} FROM {database} WITH CONFIG {config}

What: This macro will load the specified xml dataset and truncate every table listed in from the 'database' using a DbUnit configuration file.

# DELETE_ALL_DBUNIT {dataset} FROM {database} WITH CONFIG {config}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

LOAD {dataset} AS __temp_{%%rand3}.file

CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand5}.dbu

EXECUTE delete WITH __temp_{%%rand5}.dbu USING __temp{config}{%%rand2}.conf ON {database} AS __temp_{%%rand6}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')

Remarks:

  1. The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).
  2. The file designed by {config} must respect the same rules than a file which would serve to create a TA resource of category conf.dbunit via the converter of category dataset (From file to conf.dbunit).

Example:

# DELETE_ALL_DBUNIT path/to/dataset.xml FROM my_database WITH CONFIG path/to/my_config_dbunit.properties



# REFRESH_DBUNIT {dataset} INTO {database}

@Since Squash-TA framework 1.7.3

What:
 This macro will refresh all the data listed in the 'dataset file' into the 'database'. Refresh operation means that data of existing rows are updated and non-existing row get inserted. Any rows which exist in the database but not in dataset stay unaffected.
# REFRESH_DBUNIT {dataset} INTO {database}
=>
LOAD {dataset} AS __temp{%%rand1}.file

CONVERT __temp{%%rand1}.file TO file(param.relativedate) AS __temp_{%%rand2}.file
CONVERT __temp_{%%rand2}.file TO xml(structured) AS __temp_{%%rand3}.xml
CONVERT __temp_{%%rand3}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand4}.dbu

EXECUTE insert WITH __temp_{%%rand4}.dbu ON {database} USING $(operation:refresh) AS __temp_{%%rand5}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file

Remark: The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).

Example:

# REFRESH_DBUNIT path/to/dataset.xml INTO my_database



# REFRESH_DBUNIT {dataset} INTO {database} WITH CONFIG {config}

@Since Squash-TA framework 1.7.3

What: This macro will refresh all the data listed in the 'dataset file' into the 'database' using a DbUnit configuration file. Refresh operation means that data of existing rows are updated and non-existing row get inserted. Any rows which exist in the database but not in dataset stay unaffected.

# REFRESH_DBUNIT {dataset} INTO {database} WITH CONFIG {config}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

LOAD {dataset} AS __temp{%%rand3}.file

CONVERT __temp{%%rand3}.file TO file(param.relativedate) AS __temp_{%%rand4}.file
CONVERT __temp_{%%rand4}.file TO xml(structured) AS __temp_{%%rand5}.xml
CONVERT __temp_{%%rand5}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand6}.dbu

EXECUTE insert WITH __temp_{%%rand6}.dbu ON {database} USING $(operation:refresh),__temp{config}{%%rand2}.conf AS __temp_{%%rand7}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')

Remarks

  1. The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).
  2. The file designed by {config} must respect the same rules than a file which would serve to create a TA resource of category conf.dbunit via the converter of category dataset (From file to conf.dbunit).

Example:

# REFRESH_DBUNIT path/to/dataset.xml INTO my_database WITH CONFIG  path/to/my_config_dbunit.properties



# REFRESH_DBUNIT {dataset} INTO {database} USING {ppkfilter}

@Since Squash-TA framework 1.7.3

What:
 This macro will refresh all datas listed in the 'dataset file' into the 'database' using a DbUnit filter. Refresh operation means that data of existing rows are updated and non-existing row get inserted. Any rows which exist in the database but not in dataset stay unaffected.
# REFRESH_DBUNIT {dataset} INTO {database} USING {ppkfilter}
=>
LOAD {dataset} AS __temp{%%rand1}.file
CONVERT __temp{%%rand1}.file TO file(param.relativedate) AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO xml(structured) AS __temp{%%rand3}.xml
CONVERT __temp{%%rand3}.xml TO dataset.dbunit(dataset) AS __temp{%%rand4}.dbu

LOAD {ppkfilter} AS __temp{%%rand5}.file
CONVERT __temp{%%rand5}.file TO properties(structured) AS __temp{%%rand6}.props
CONVERT __temp{%%rand6}.props TO conf.dbunit.ppk(from.properties) AS __temp{%%rand7}.ppk

EXECUTE insert WITH __temp{%%rand4}.dbu ON {database} USING __temp{%%rand7}.ppk,$(operation:refresh) AS __temp_{%%rand8}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {ppkfilter}: A DbUnit filter referring to pseudo primary keys('.properties')

Example:

# REFRESH_DBUNIT path/to/dataset.xml INTO my_database USING path/to/my_filter_dbunit.properties



# REFRESH_DBUNIT {dataset} INTO {database} WITH CONFIG {config} USING {ppkfilter}

@Since Squash-TA framework 1.7.3

What: This macro will refresh all the data listed in the 'dataset file' into the 'database' using a DbUnit configuration file and a DbUnit filter. Refresh operation means that data of existing rows are updated and non-existing row get inserted. Any rows which exist in the database but not in dataset stay unaffected.

# REFRESH_DBUNIT {dataset} INTO {database} WITH CONFIG {config} USING {ppkfilter}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

LOAD {dataset} AS __temp{%%rand3}.file
CONVERT __temp{%%rand3}.file TO file(param.relativedate) AS __temp_{%%rand4}.file
CONVERT __temp_{%%rand4}.file TO xml(structured) AS __temp_{%%rand5}.xml
CONVERT __temp_{%%rand5}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand6}.dbu

LOAD {ppkfilter} AS __temp{%%rand7}.file
CONVERT __temp{%%rand7}.file TO properties(structured) AS __temp{%%rand8}.props
CONVERT __temp{%%rand8}.props TO conf.dbunit.ppk(from.properties) AS __temp{%%rand9}.ppk

EXECUTE insert WITH __temp_{%%rand6}.dbu ON {database} USING __temp{%%rand9}.ppk,$(operation:refresh),__temp{config}{%%rand2}.conf AS __temp_{%%rand10}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')
  • {ppkfilter}: A DbUnit filter referring to pseudo primary keys('.properties')

Example:

# REFRESH_DBUNIT path/to/dataset.xml INTO my_database WITH CONFIG path/to/my_config_dbunit.properties USING path/to/my_filter_dbunit.properties



# UPDATE_DBUNIT {dataset} INTO {database}

@Since Squash-TA framework 1.7.3

What:
 This macro will update all the data listed in the 'dataset file' into the 'database'. This update operation assumes that table data already exists in the target database and fails if this is not the case.
# UPDATE_DBUNIT {dataset} INTO {database}
=>
LOAD {dataset} AS __temp{%%rand1}.file

CONVERT __temp{%%rand1}.file TO file(param.relativedate) AS __temp_{%%rand2}.file
CONVERT __temp_{%%rand2}.file TO xml(structured) AS __temp_{%%rand3}.xml
CONVERT __temp_{%%rand3}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand4}.dbu

EXECUTE insert WITH __temp_{%%rand4}.dbu ON {database} USING $(operation:update) AS __temp_{%%rand5}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file

Remark: The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).

Example:

# UPDATE_DBUNIT path/to/dataset.xml INTO my_database



# UPDATE_DBUNIT {dataset} INTO {database} WITH CONFIG {config}

@Since Squash-TA framework 1.7.3

What: This macro will update all the data listed in the 'dataset file' into the 'database' using a DbUnit configuration file. This update operation assumes that table data already exists in the target database and fails if this is not the case.

# UPDATE_DBUNIT {dataset} INTO {database} WITH CONFIG {config}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

LOAD {dataset} AS __temp{%%rand3}.file

CONVERT __temp{%%rand3}.file TO file(param.relativedate) AS __temp_{%%rand4}.file
CONVERT __temp_{%%rand4}.file TO xml(structured) AS __temp_{%%rand5}.xml
CONVERT __temp_{%%rand5}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand6}.dbu

EXECUTE insert WITH __temp_{%%rand6}.dbu ON {database} USING $(operation:update),__temp{config}{%%rand2}.conf AS __temp_{%%rand7}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')

Remarks

  1. The file designed by {dataset} must respect the same rules than a file which would serve to create a TA resource of category dataset.dbunit via the converter of category dataset (From xml to dataset.dbunit).
  2. The file designed by {config} must respect the same rules than a file which would serve to create a TA resource of category conf.dbunit via the converter of category dataset (From file to conf.dbunit).

Example:

# UPDATE_DBUNIT path/to/dataset.xml INTO my_database WITH CONFIG  path/to/my_config_dbunit.properties



# UPDATE_DBUNIT {dataset} INTO {database} USING {ppkfilter}

@Since Squash-TA framework 1.7.3

What:
 This macro will update all datas listed in the 'dataset file' into the 'database' using a DbUnit filter. This update operation assumes that table data already exists in the target database and fails if this is not the case.
# UPDATE_DBUNIT {dataset} INTO {database} USING {ppkfilter}
=>
LOAD {dataset} AS __temp{%%rand1}.file
CONVERT __temp{%%rand1}.file TO file(param.relativedate) AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO xml(structured) AS __temp{%%rand3}.xml
CONVERT __temp{%%rand3}.xml TO dataset.dbunit(dataset) AS __temp{%%rand4}.dbu

LOAD {ppkfilter} AS __temp{%%rand5}.file
CONVERT __temp{%%rand5}.file TO properties(structured) AS __temp{%%rand6}.props
CONVERT __temp{%%rand6}.props TO conf.dbunit.ppk(from.properties) AS __temp{%%rand7}.ppk

EXECUTE insert WITH __temp{%%rand4}.dbu ON {database} USING __temp{%%rand7}.ppk,$(operation:update) AS __temp_{%%rand8}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {ppkfilter}: A DbUnit filter referring to pseudo primary keys('.properties')

Example:

# UPDATE_DBUNIT path/to/dataset.xml INTO my_database USING path/to/my_filter_dbunit.properties



# UPDATE_DBUNIT {dataset} INTO {database} WITH CONFIG {config} USING {ppkfilter}

@Since Squash-TA framework 1.7.3

What: This macro will update all the data listed in the 'dataset file' into the 'database' using a DbUnit configuration file and a DbUnit filter. This update operation assumes that table data already exists in the target database and fails if this is not the case.

# UPDATE_DBUNIT {dataset} INTO {database} WITH CONFIG {config} USING {ppkfilter}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

LOAD {dataset} AS __temp{%%rand3}.file
CONVERT __temp{%%rand3}.file TO file(param.relativedate) AS __temp_{%%rand4}.file
CONVERT __temp_{%%rand4}.file TO xml(structured) AS __temp_{%%rand5}.xml
CONVERT __temp_{%%rand5}.xml TO dataset.dbunit(dataset) AS __temp_{%%rand6}.dbu

LOAD {ppkfilter} AS __temp{%%rand7}.file
CONVERT __temp{%%rand7}.file TO properties(structured) AS __temp{%%rand8}.props
CONVERT __temp{%%rand8}.props TO conf.dbunit.ppk(from.properties) AS __temp{%%rand9}.ppk

EXECUTE insert WITH __temp_{%%rand6}.dbu ON {database} USING __temp{%%rand9}.ppk,$(operation:update),__temp{config}{%%rand2}.conf AS __temp_{%%rand10}.result

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')
  • {ppkfilter}: A DbUnit filter referring to pseudo primary keys('.properties')

Example:

# UPDATE_DBUNIT path/to/dataset.xml INTO my_database WITH CONFIG path/to/my_config_dbunit.properties USING path/to/my_filter_dbunit.properties



# ASSERT_DBUNIT TARGET {database} CONTAINS {dataset}

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database'.

# ASSERT_DBUNIT TARGET {database} CONTAINS {dataset}
=>

EXECUTE get.all WITH $() ON {database} AS __actual_{%%rand1}.dbu

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

ASSERT __actual_{%%rand1}.dbu DOES contain THE __expected_{%%rand5}.dbu

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file

Notes:

  1. If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.
  2. No need to put all tables
  3. No need to put all lines of specified tables
  4. No need to put all columns of specified tables

Example:

# ASSERT_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml



# ASSERT_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config}

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database' using a DbUnit configuration file.

# ASSERT_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config}
=>

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

ASSERT __actual_{%%rand3}.dbu DOES contain THE __expected_{%%rand7}.dbu

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')

Notes:

  1. If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.
  2. No need to put all tables
  3. No need to put all lines of specified tables
  4. No need to put all columns of specified tables

Example:

# ASSERT_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml WITH CONFIG path/to/my_config_dbunit.properties


# ASSERT_DBUNIT TARGET {database} CONTAINS {dataset} WITH FILTER {filter}

@Since Squash-TA framework 1.7.2

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database' using a DbUnit filter.

# ASSERT_DBUNIT TARGET {database} CONTAINS {dataset} WITH FILTER {filter}
=>

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

LOAD {filter} AS __filter_{%%rand6}.file
CONVERT __filter_{%%rand6}.file TO filter.dbunit(filter) AS __filter_{%%rand7}.filter

ASSERT __actual_{%%rand1}.dbu DOES contain THE __expected_{%%rand5}.dbu USING __filter_{%%rand7}.filter

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {filter}: A Dbunit filter ( filter.dbunit TA resource)

Notes:

  1. If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# ASSERT_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml WITH FILTER path/to/my_dbunit_filter.xml



# ASSERT_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config} AND FILTER {filter}

@Since Squash-TA framework 1.7.2

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database' using a DbUnit configuration file and a DbUnit filter.

# ASSERT_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {CONFIG} AND FILTER {filter}
=>

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

LOAD {filter} AS __filter_{%%rand8}.file
CONVERT __filter_{%%rand8}.file TO filter.dbunit(filter) AS __filter_{%%rand9}.filter

ASSERT __actual_{%%rand3}.dbu DOES contain THE __expected_{%%rand7}.dbu USING __filter_{%%rand9}.filter

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties'). It should be a 'conf.dbunit' TA resource
  • {filter}: A Dbunit filter xml file. It should be a 'filter.dbunit' TA resource

Notes:

  1. If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# ASSERT_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml WITH CONFIG path/to/my_dbunit_config.properties AND FILTER path/to/my_dbunit_filter.xml



# ASSERT_DBUNIT TARGET {database} EQUALS {dataset}

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database' and the reverse.
# ASSERT_DBUNIT TARGET {database} EQUALS {dataset}
=>

EXECUTE get.all WITH $() ON {database} AS __actual_{%%rand1}.dbu

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

ASSERT __actual_{%%rand1}.dbu IS equal THE __expected_{%%rand5}.dbu

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file

Note: If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# ASSERT_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml



# ASSERT_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config}

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database' and the reverse using a DbUnit configuration file
# ASSERT_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

ASSERT __actual_{%%rand3}.dbu IS equal THE __expected_{%%rand7}.dbu

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')

Note: If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# ASSERT_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml WITH CONFIG path/to/my_config_dbunit.properties



# ASSERT_DBUNIT TARGET {database} EQUALS {dataset} WITH FILTER {filter}

@Since Squash-TA framework 1.7.2

What:
This macro will check that all the data listed in the 'dataset file' exist in the 'database' and the reverse using a DbUnit filter
# ASSERT_DBUNIT TARGET {database} EQUALS {dataset} WITH FILTER {filter}
=>

EXECUTE get.all WITH $() ON {database} AS __actual_{%%rand1}.dbu

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

LOAD {filter} AS __filter_{%%rand6}.file
CONVERT __filter_{%%rand6}.file TO filter.dbunit(filter) AS __filter_{%%rand7}.filter

ASSERT __actual_{%%rand1}.dbu IS equal THE __expected_{%%rand5}.dbu USING __filter_{%%rand7}.filter

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {filter}: A DbUnit filter xml file. It should be a 'filter.dbunit' TA resource

Note: If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# ASSERT_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml WITH FILTER path/to/my_dbunit_filter.xml



# ASSERT_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config} AND FILTER {filter}

@Since Squash-TA framework 1.7.2

What:
This macro will check that all the data listed in the 'dataset file' exist in the 'database' and the reverse using a DbUnit configuration file and a DbUnit filter
# ASSERT_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config} AND FILTER {filter}
=>

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

LOAD {filter} AS __filter_{%%rand8}.file
CONVERT __filter_{%%rand8}.file TO filter.dbunit(filter) AS __filter_{%%rand9}.filter

ASSERT __actual_{%%rand3}.dbu IS equal THE __expected_{%%rand7}.dbu USING __filter_{%%rand9}.filter

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties'). It should be a 'conf.dbunit' TA resource
  • {filter}: A DbUnit filter xml file. It should be a 'filter.dbunit' TA resource

Note: If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# ASSERT_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml WITH CONFIG path/to/my_dbunit_config.properties AND FILTER path/to/my_dbunit_filter.xml



# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset}

@Since Squash-TA framework 1.7.2

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database'.

# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset}
=>

EXECUTE get.all WITH $() ON {database} AS __actual_{%%rand1}.dbu

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

VERIFY __actual_{%%rand1}.dbu DOES contain THE __expected_{%%rand5}.dbu

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file

Notes:

  1. If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# VERIFY_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml



# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config}

@Since Squash-TA framework 1.7.2

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database' using a DbUnit configuration file.

# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config}
=>

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

VERIFY __actual_{%%rand3}.dbu DOES contain THE __expected_{%%rand7}.dbu

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')

Notes:

  1. If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# VERIFY_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml WITH CONFIG path/to/my_config_dbunit.properties


# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH FILTER {filter}

@Since Squash-TA framework 1.7.2

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database' using a DbUnit filter.

# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH FILTER {filter}
=>

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

LOAD {filter} AS __filter_{%%rand6}.file
CONVERT __filter_{%%rand6}.file TO filter.dbunit(filter) AS __filter_{%%rand7}.filter

VERIFY __actual_{%%rand1}.dbu DOES contain THE __expected_{%%rand5}.dbu USING __filter_{%%rand7}.filter

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {filter}: A Dbunit filter ( filter.dbunit TA resource)

Notes:

  1. If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# VERIFY_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml WITH FILTER path/to/my_dbunit_filter.xml



# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config} AND FILTER {filter}

@Since Squash-TA framework 1.7.2

What: This macro will check that all the data listed in the 'dataset file' exist in the 'database' using a DbUnit configuration file and a DbUnit filter.

# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {CONFIG} AND FILTER {filter}
=>

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

LOAD {filter} AS __filter_{%%rand8}.file
CONVERT __filter_{%%rand8}.file TO filter.dbunit(filter) AS __filter_{%%rand9}.filter

VERIFY __actual_{%%rand3}.dbu DOES contain THE __expected_{%%rand7}.dbu USING __filter_{%%rand9}.filter

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties'). It should be a 'conf.dbunit' TA resource
  • {filter}: A Dbunit filter xml file. It should be a 'filter.dbunit' TA resource

Notes:

  1. If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# VERIFY_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml WITH CONFIG path/to/my_dbunit_config.properties AND FILTER path/to/my_dbunit_filter.xml



# VERIFY_DBUNIT TARGET {database} EQUALS {dataset}

@Since Squash-TA framework 1.7.2

What:
This macro will check that all the data listed in the 'dataset file' exist in the 'database' and the reverse.
# VERIFY_DBUNIT TARGET {database} EQUALS {dataset}
=>

EXECUTE get.all WITH $() ON {database} AS __actual_{%%rand1}.dbu

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

VERIFY __actual_{%%rand1}.dbu IS equal THE __expected_{%%rand5}.dbu

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file

Note: If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# ASSERT_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml



# VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config}

@Since Squash-TA framework 1.7.2

What:
This macro will check that all the data listed in the 'dataset file' exist in the 'database' and the reverse using a DbUnit configuration file
# VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config}
=>
LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

VERIFY __actual_{%%rand3}.dbu IS equal THE __expected_{%%rand7}.dbu

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties')

Note: If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# VERIFY_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml WITH CONFIG path/to/my_config_dbunit.properties



# VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH FILTER {filter}

@Since Squash-TA framework 1.7.2

What:
This macro will check that all the data listed in the 'dataset file' exist in the 'database' and the reverse using a DbUnit filter
# VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH FILTER {filter}
=>

EXECUTE get.all WITH $() ON {database} AS __actual_{%%rand1}.dbu

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

LOAD {filter} AS __filter_{%%rand6}.file
CONVERT __filter_{%%rand6}.file TO filter.dbunit(filter) AS __filter_{%%rand7}.filter

VERIFY __actual_{%%rand1}.dbu IS equal THE __expected_{%%rand5}.dbu USING __filter_{%%rand7}.filter

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {filter}: A DbUnit filter xml file. It should be a 'filter.dbunit' TA resource

Note: If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# VERIFY_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml WITH FILTER path/to/my_dbunit_filter.xml



# VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config} AND FILTER {filter}

@Since Squash-TA framework 1.7.2

What:
This macro will check that all the data listed in the 'dataset file' exist in the 'database' and the reverse using a DbUnit configuration file and a DbUnit filter
# VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config} AND FILTER {filter}
=>

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

LOAD {filter} AS __filter_{%%rand8}.file
CONVERT __filter_{%%rand8}.file TO filter.dbunit(filter) AS __filter_{%%rand9}.filter

VERIFY __actual_{%%rand3}.dbu IS equal THE __expected_{%%rand7}.dbu USING __filter_{%%rand9}.filter

Input:

  • {database}: The name (in the context) of the database to use (Target of category database).
  • {dataset}: A flat xml dbunit dataset file
  • {config}: A configuration file for DbUnit ('.properties'). It should be a 'conf.dbunit' TA resource
  • {filter}: A DbUnit filter xml file. It should be a 'filter.dbunit' TA resource

Note: If the file designed by {dataset} contains formulas of date calculation (See the converter ' From file to file via param.relativedate), those one are calculated and replaced by the value.

Example:

# VERIFY_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml WITH CONFIG path/to/my_dbunit_config.properties AND FILTER path/to/my_dbunit_filter.xml