From a8e6399430890432ba0c3b4ac483b43ea6efb257 Mon Sep 17 00:00:00 2001 From: Ulrich Carmesin Date: Mon, 29 Aug 2022 14:35:07 +0200 Subject: [PATCH] mapping --- .gitignore | 1 + test/test_31db.py | 4 ++-- testrest/CONFIG.yml | 17 +++++++++++++++-- testrest/Testrest.py | 2 +- testrest/mapping-rest.yml | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 testrest/mapping-rest.yml diff --git a/.gitignore b/.gitignore index 8b04957..3a2310d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ __pycache__ */__pycache__/* .. +temp diff --git a/test/test_31db.py b/test/test_31db.py index 2afd3cf..d8c3562 100644 --- a/test/test_31db.py +++ b/test/test_31db.py @@ -64,7 +64,7 @@ class MyTestCase(unittest.TestCase): comp.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB] = {} comp.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB][B.ATTR_TYPE] = "rel" comp.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB][B.ATTR_DB_DATABASE] = "crm-db" - tool = basic.toolHandling.getDbTool(comp) + tool = basic.toolHandling.getDbTool(job, comp) self.assertRegex(str(type(tool)), 'dbrel_tool.DbFcts') def test_02parseSql(self): @@ -86,7 +86,7 @@ class MyTestCase(unittest.TestCase): comp.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB] = {} comp.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB][B.ATTR_TYPE] = "rel" comp.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB][B.ATTR_DB_DATABASE] = "crm-db" - tool = basic.toolHandling.getDbTool(comp) + tool = basic.toolHandling.getDbTool(job, comp) attr = tool.getDbAttributes("xx") self.assertRegex(attr[B.ATTR_DB_PARTITION], 'n') comp.conf[B.SUBJECT_CONN][B.TOPIC_NODE_DB][B.ATTR_DB_PARTITION] = "y" diff --git a/testrest/CONFIG.yml b/testrest/CONFIG.yml index b40e863..0d4bff5 100644 --- a/testrest/CONFIG.yml +++ b/testrest/CONFIG.yml @@ -13,14 +13,27 @@ conf: execute_testcase: "todo" collect_testcase: "todo" # -> postcondition, check data compare_testcase: "todo" # -> postcondition, check data + _steps: + xml-rest: + - tool: file + type: xml + fct: create + - tool: cli + cmd: "cp-to {}" + json-rest: + - tool: file + type: json + fct: create + - tool: cli + cmd: "cp-to {}" artifact: file: reset: testcase - jsonrest: + json-rest: name: json-rest type: json path: requests - xmlrest: + xml-rest: name: xml-rest type: xml path: requests diff --git a/testrest/Testrest.py b/testrest/Testrest.py index df4f583..9125f71 100644 --- a/testrest/Testrest.py +++ b/testrest/Testrest.py @@ -11,7 +11,7 @@ class Testrest(basic.component.Component): :param step: :return: """ - fileClass = basic.toolHandling.getDbTool(self) + fileClass = basic.toolHandling.getDbTool(job, self) pass diff --git a/testrest/mapping-rest.yml b/testrest/mapping-rest.yml new file mode 100644 index 0000000..00df1c8 --- /dev/null +++ b/testrest/mapping-rest.yml @@ -0,0 +1,32 @@ +rest: + sender: + _id: "sender={_data.person._sender(_steps._nr)}" + client-name: "{_catalog.sender.name(sender)}" + client-id: "{_catalog.sender.client-id(sender)}" + client-depart: "{_catalog.sender.department(sender)}" + messages: + _foreach: "msgid={_steps._nr}" + message: + '@nr': "{msgid}" + '@action': "{_steps.args.action}" + #msgid: "{gen.genId(n8)}" + timestamp: "{_par.tctime}" + customer: + _id: "{msgid}" + _row: "{_data.person(msgid)}" + name: "{_row.person.name}" + famname: "{_row.person.famname}" + adress: + _id: "{msgid}" + _row: "{_data.adress(msgid)}" + street: "{_row.adress.street}" + city: "{_row.adress.city}" + zip: "{_row.adress.zip}" + position: + _foreach: "posid={_data.product._nr,_pos(msgid)}" + #'@id': "$i" + product: + _id: "{posid}" + _row: "{_data.product(posid)}" + description: "{_row.product.descript}" + prdtype: "{_row.product.objtype}"