From 2ecdc5387ac08f9c1fda4763f031b841d81c4942 Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 10:15:59 +0100 Subject: [PATCH 01/13] [FEATURE] traces in log --- test/acceptance/behave/README.md | 10 +- .../components/common_steps/general_steps.py | 23 +++ .../create_entity_traces_in_log.feature | 88 ++++++++++++ .../list_entities_traces_in_log.feature | 134 ++++++++++++++++++ test/acceptance/behave/tools/NGSI_v2.py | 28 +++- 5 files changed, 278 insertions(+), 5 deletions(-) create mode 100644 test/acceptance/behave/components/ngsiv2/entities/create_entity/create_entity_traces_in_log.feature create mode 100644 test/acceptance/behave/components/ngsiv2/entities/list_entities/list_entities_traces_in_log.feature diff --git a/test/acceptance/behave/README.md b/test/acceptance/behave/README.md index 213ea9cf7d..74ce38ed93 100644 --- a/test/acceptance/behave/README.md +++ b/test/acceptance/behave/README.md @@ -304,9 +304,11 @@ The log is stored in `logs` folder (if this folder does not exist it is created) | delete_context_provider_registration | (pending) | DELETE | /v2/registrations/`` | No | No | | | |**alarms folder** | (pending) | | +| | |**cli_parameters folder** | (pending) | | - + + ## Hints: - If we need " char, use \' and it will be replaced (`mappping_quotes` method in `helpers_utils.py` library) (limitation in behave and lettuce). - If value is "max length allowed", per example, it is a generated random value with max length allowed and characters allowed. @@ -343,7 +345,11 @@ The log is stored in `logs` folder (if this folder does not exist it is created) ``` create an entity in raw and "normalized" modes ``` - + - If don´t want verify the value of something trace in log, use `ignored` as value. + ``` + | trace | value | + | time | ignored | + ``` ## Tags diff --git a/test/acceptance/behave/components/common_steps/general_steps.py b/test/acceptance/behave/components/common_steps/general_steps.py index 4be9a20059..b7e3cb60e4 100644 --- a/test/acceptance/behave/components/common_steps/general_steps.py +++ b/test/acceptance/behave/components/common_steps/general_steps.py @@ -28,6 +28,8 @@ from iotqatools.helpers_utils import * from iotqatools.cb_v2_utils import CB from iotqatools.mongo_utils import Mongo +from iotqatools.remote_log_utils import Remote_Log +from iotqatools.fabric_utils import FabricSupport from tools.properties_config import Properties # methods in properties class from tools.NGSI_v2 import NGSI @@ -140,6 +142,27 @@ def delete_database_in_mongo(context): mongo.disconnect() __logger__.info("...Database \"%s\" is deleted" % database_name) + +@step(u'check in log, label "([^"]*)" and message "([^"]*)"') +def check_in_log_label_and_text(context, label, text): + """ + Verify in log file if a label with a message exists + :param step: + :param label: label to find + :param text: text to find (begin since the end) + """ + __logger__.debug("Looking for in log the \"%s\" label and the \"%s\" text...") + props_cb_env = properties_class.read_properties()[CONTEXT_BROKER_ENV] + remote_log = Remote_Log(file="%s/contextBroker.log" % props_cb_env["CB_LOG_FILE"], fabric=context.my_fab) + line = remote_log.find_line(label,text) + assert line != None, " ERROR - the \"%s\" label and the \"%s\" text do not exist in the log" + __logger__.info("log line: \n%s" %line) + ngsi = NGSI() + ngsi.verify_log(context, line) + __logger__.info("...confirmed traces in log") + + + # ------------------------------------- validations ---------------------------------------------- @step(u'verify that receive a.? "([^"]*)" http code') diff --git a/test/acceptance/behave/components/ngsiv2/entities/create_entity/create_entity_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/entities/create_entity/create_entity_traces_in_log.feature new file mode 100644 index 0000000000..7e90c6828a --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/entities/create_entity/create_entity_traces_in_log.feature @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with create entity request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with create entity request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 if create a new entity + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + When create entity group with "1" entities in "normalized" mode + And verify that receive several "Created" http code + And verify that entities are stored in mongo + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | diff --git a/test/acceptance/behave/components/ngsiv2/entities/list_entities/list_entities_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/entities/list_entities/list_entities_traces_in_log.feature new file mode 100644 index 0000000000..beb10ec1a1 --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/entities/list_entities/list_entities_traces_in_log.feature @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with list entities request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with list entities request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 if list entities + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + And initialize entity groups recorder + And properties to entities + | parameter | value | + | entities_type | home | + | entities_id | room1 | + | attributes_number | 2 | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | random=10 | + And create entity group with "5" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + And record entity group + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room2 | + | attributes_number | 2 | + | attributes_name | temperature | + | attributes_value | 45 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | random=10 | + And create entity group with "5" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + And record entity group + And properties to entities + | parameter | value | + | entities_type | "car" | + | entities_id | "vehicle" | + | attributes_name | "speed" | + | attributes_value | 89 | + | attributes_type | "km_h" | + | metadatas_name | "very_hot" | + | metadatas_type | "alarm" | + | metadatas_value | "hot" | + And create an entity in raw and "normalized" modes + And verify that receive several "Created" http code + And record entity group + When get all entities + | parameter | value | + | limit | 9 | + | offset | 0 | + | type | car | + | id | vehicle | + | q | speed>78 | + | options | count | + Then verify that receive an "OK" http code + And verify that "1" entities are returned + And verify headers in response + | parameter | value | + | x-total-count | 1 | + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | diff --git a/test/acceptance/behave/tools/NGSI_v2.py b/test/acceptance/behave/tools/NGSI_v2.py index 6ac131bfd9..1610b9073d 100644 --- a/test/acceptance/behave/tools/NGSI_v2.py +++ b/test/acceptance/behave/tools/NGSI_v2.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ - Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U + Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U This file is part of Orion Context Broker. @@ -20,12 +20,14 @@ For those usages not covered by this license please contact with iot_support at tid dot es """ -import copy -import re __author__ = 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' +import copy +import re + from iotqatools.helpers_utils import * +from iotqatools.remote_log_utils import Remote_Log # constants EMPTY = u'' @@ -33,6 +35,7 @@ FIWARE_SERVICE_PATH_HEADER = u'Fiware-ServicePath' ORION_PREFIX = u'orion' PARAMETER = u'parameter' +TRACE = u'trace' VALUE = u'value' __logger__ = logging.getLogger("utils") @@ -898,3 +901,22 @@ def verify_attributes_types_with_entity_types(self, queries_parameters, accumula assert count == count_total, " ERROR - the x-total-count header: %d does not match with the expected total: %d" \ % (count, count_total) + def verify_log(self, context, line): + """ + verify if traces match in the log line + :param context: It’s a clever place where you and behave can store information to share around. It runs at three levels, automatically managed by behave. + :param line: log line to seek all traces + """ + trace = {} + for row in context.table: + trace[row[TRACE]] = row[VALUE] + + for key, value in trace.items(): + assert line.find(key) >= 0,u'ERROR - the "%s" trace does not exist in the line: \n %s' % (key, line) + __logger__.info(u' the "%s" trace does exist in log line' % key) + if trace[key] != "ignored": + remote_log = Remote_Log() + line_value = remote_log.get_trace(line, key) + assert trace[key] == line_value, \ + u' ERROR - the "%s" value expected in the "%s" trace does not match with "%s" line value...' \ + % (trace[key], key, line_value) From 6ce3ea3f9b8c651031770edb42de99e0a61e6c1a Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 10:40:18 +0100 Subject: [PATCH 02/13] [ADD] trace log in remove entity request --- .../remove_entity_traces_in_log.feature | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/entities/remove_entity/remove_entity_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/entities/remove_entity/remove_entity_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/entities/remove_entity/remove_entity_traces_in_log.feature new file mode 100644 index 0000000000..f0874ec13b --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/entities/remove_entity/remove_entity_traces_in_log.feature @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with remove entity request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with remove entity request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with remove an entity + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 45 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + When delete an entity with id "room_1" + Then verify that receive a "No Content" http code + And verify that entities are not stored in mongo + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From 543e2f2c2eaf80e5e4b26b923415ba16bd4c4eab Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 10:55:41 +0100 Subject: [PATCH 03/13] [ADD] trace log in replace all entity attributes request --- ...ll_entity_attributes_traces_in_log.feature | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/entities/replace_all_entity_attributes/replace_all_entity_attributes_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/entities/replace_all_entity_attributes/replace_all_entity_attributes_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/entities/replace_all_entity_attributes/replace_all_entity_attributes_traces_in_log.feature new file mode 100644 index 0000000000..4cf6aaf813 --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/entities/replace_all_entity_attributes/replace_all_entity_attributes_traces_in_log.feature @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with replace all entity attributes request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with replace all entity attributes request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with replace all entity attributes request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + # These properties below are used in update request + And properties to entities + | parameter | value | + | attributes_number | 5 | + | attributes_name | humidity | + | attributes_value | 80 | + | attributes_type | Fahrenheit | + | metadatas_number | 3 | + | metadatas_name | very_cold | + | metadatas_type | alarm | + | metadatas_value | cold | + When replace attributes by ID "room_1" if it exists and with "normalized" mode + Then verify that receive an "No Content" http code + And verify that an entity is updated in mongo + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From 9a87356095cbfd8bd8d9cfac860e9905ed4c9b51 Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 10:59:47 +0100 Subject: [PATCH 04/13] [ADD] trace log in retrieve entity request --- .../retrieve_entity_traces_in_log.feature | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/entities/retrieve_entity/retrieve_entity_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/entities/retrieve_entity/retrieve_entity_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/entities/retrieve_entity/retrieve_entity_traces_in_log.feature new file mode 100644 index 0000000000..427e07f63f --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/entities/retrieve_entity/retrieve_entity_traces_in_log.feature @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with retrieve entity request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with retrieve entity request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with retrieve entity request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + When get an entity by ID "room_0" + | parameter | value | + | attrs | temperature_0,temperature_1 | + Then verify that receive an "OK" http code + And verify that the entity by ID is returned + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From 18798977c3086ad7b3dd4863c547b6f0c87f3e2c Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 11:07:13 +0100 Subject: [PATCH 05/13] [ADD] trace log in update existing entity attributes request --- ...ng_entity_attributes_traces_in_log.feature | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/entities/update_existing_entity_attributes/update_existing_entity_attributes_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/entities/update_existing_entity_attributes/update_existing_entity_attributes_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/entities/update_existing_entity_attributes/update_existing_entity_attributes_traces_in_log.feature new file mode 100644 index 0000000000..d7b0c9ef3c --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/entities/update_existing_entity_attributes/update_existing_entity_attributes_traces_in_log.feature @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with update existing entity attributes request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with update existing entity attributes request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with update existing entity attributes request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + # These properties below are used in update request + And properties to entities + | parameter | value | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 80 | + | attributes_type | Fahrenheit | + | metadatas_number | 3 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | cold | + When update attributes by ID "room_1" if it exists and with "normalized" mode + Then verify that receive an "No Content" http code + And verify that an entity is updated in mongo + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From d3d3dd711d2b9aed447a340236fc0a466019c18c Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 11:10:24 +0100 Subject: [PATCH 06/13] [ADD] trace log in update or append entity attributes request --- ...nd_entity_attributes_traces_in_log.feature | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/entities/update_or_append_entity_attributes/update_or_append_entity_attributes_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/entities/update_or_append_entity_attributes/update_or_append_entity_attributes_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/entities/update_or_append_entity_attributes/update_or_append_entity_attributes_traces_in_log.feature new file mode 100644 index 0000000000..edf248d85a --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/entities/update_or_append_entity_attributes/update_or_append_entity_attributes_traces_in_log.feature @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with update or append entity attributes request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with update or append entity attributes request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with update or append entity attributes request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + # These properties below are used in update request + And properties to entities + | parameter | value | + | attributes_number | 4 | + | attributes_name | temperature | + | attributes_value | 80 | + | attributes_type | Fahrenheit | + | metadatas_number | 3 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | cold | + When update or append attributes by ID "room_1" and with "normalized" mode + Then verify that receive an "No Content" http code + And verify that an entity is updated in mongo + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From bbceaf8194878fe94336604c87b93e2151a1f3e8 Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 11:17:42 +0100 Subject: [PATCH 07/13] [ADD] trace log in get attribute data request --- .../get_attribute_data_traces_in_log.feature | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/attributes/get_attribute_data/get_attribute_data_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/attributes/get_attribute_data/get_attribute_data_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/attributes/get_attribute_data/get_attribute_data_traces_in_log.feature new file mode 100644 index 0000000000..35d5da9c3f --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/attributes/get_attribute_data/get_attribute_data_traces_in_log.feature @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with get attribute data request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with get attribute data request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with get attribute data request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + When get an attribute "temperature_0" by ID "room_1" + Then verify that receive an "OK" http code + And verify that the attribute by ID is returned + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From eb8a520384c482428608cd704952a2a49435b5c8 Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 11:19:28 +0100 Subject: [PATCH 08/13] [ADD] trace log in remove a single attribute request --- ...e_a_single_attribute_traces_in_log.feature | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/attributes/remove_a_single_attribute/remove_a_single_attribute_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/attributes/remove_a_single_attribute/remove_a_single_attribute_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/attributes/remove_a_single_attribute/remove_a_single_attribute_traces_in_log.feature new file mode 100644 index 0000000000..cd936a1eed --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/attributes/remove_a_single_attribute/remove_a_single_attribute_traces_in_log.feature @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with remove a single attribute request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with remove a single attribute request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with remove a single attribute request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + When delete an attribute "temperature_0" in the entity with id "room_1" + Then verify that receive an "No Content" http code + And verify that the attribute is deleted into mongo in the defined entity + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From 04bd32bd5fa9340cd58b594ecafc26d2423e79e2 Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 11:22:48 +0100 Subject: [PATCH 09/13] [ADD] trace log in update attribute data request --- ...pdate_attribute_data_traces_in_log.feature | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/attributes/update_attribute_data/update_attribute_data_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/attributes/update_attribute_data/update_attribute_data_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/attributes/update_attribute_data/update_attribute_data_traces_in_log.feature new file mode 100644 index 0000000000..e84d01f8c6 --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/attributes/update_attribute_data/update_attribute_data_traces_in_log.feature @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with update attribute data request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with update attribute data request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with update attribute data request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + # These properties below are used in update request + And properties to entities + | parameter | value | + | attributes_value | 80 | + | attributes_type | Fahrenheit | + | metadatas_number | 3 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | cold | + When update an attribute by ID "room_1" and attribute name "temperature_0" if it exists + Then verify that receive an "No Content" http code + And verify that an entity is updated in mongo + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From abcf9f5a57283961478821c9ae236a4c55e8c65e Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 11:26:28 +0100 Subject: [PATCH 10/13] [ADD] trace log in get attribute value request --- .../get_attribute_value_traces_in_log.feature | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/attributes_values/get_attribute_value/get_attribute_value_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/attributes_values/get_attribute_value/get_attribute_value_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/attributes_values/get_attribute_value/get_attribute_value_traces_in_log.feature new file mode 100644 index 0000000000..0648fcfb29 --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/attributes_values/get_attribute_value/get_attribute_value_traces_in_log.feature @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with get attribute value request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with get attribute value request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with get attribute value request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 34.67 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + # These headers below are appended to previous headers in get request + And modify headers and keep previous values "true" + | parameter | value | + | Accept | text/plain | + When get an attribute value by ID "room_1" and attribute name "temperature_0" if it exists + Then verify that receive an "OK" http code + And verify that the attribute value by ID is returned + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From 21d521bf54df6e6fc06d870aa8f9fc099f08b354 Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 11:30:01 +0100 Subject: [PATCH 11/13] [ADD] trace log in update attribute value request --- ...date_attribute_value_traces_in_log.feature | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/attributes_values/update_attribute_value/update_attribute_value_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/attributes_values/update_attribute_value/update_attribute_value_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/attributes_values/update_attribute_value/update_attribute_value_traces_in_log.feature new file mode 100644 index 0000000000..f5bd243aa1 --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/attributes_values/update_attribute_value/update_attribute_value_traces_in_log.feature @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with update attribute value request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with update attribute value request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with update attribute value request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room | + | attributes_number | 3 | + | attributes_name | temperature | + | attributes_value | 34 | + | attributes_type | celsius | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | hot | + And create entity group with "3" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + # These headers below are appended to previous headers in update request + And modify headers and keep previous values "true" + | parameter | value | + | Content-Type | text/plain | + # These properties below are used in update request + And properties to entities + | parameter | value | + | attributes_value | 80 | + When update an attribute value by ID "room_1" and attribute name "temperature_0" if it exists + Then verify that receive an "No Content" http code + And verify that an entity is updated in mongo + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From 55d869470b32491298b5a796e89830ea54cb78af Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 11:33:54 +0100 Subject: [PATCH 12/13] [ADD] trace log in retrieve entity types request --- ...etrieve_entity_types_traces_in_log.feature | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 test/acceptance/behave/components/ngsiv2/types/retrieve_entity_types/retrieve_entity_types_traces_in_log.feature diff --git a/test/acceptance/behave/components/ngsiv2/types/retrieve_entity_types/retrieve_entity_types_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/types/retrieve_entity_types/retrieve_entity_types_traces_in_log.feature new file mode 100644 index 0000000000..20b8cebfd0 --- /dev/null +++ b/test/acceptance/behave/components/ngsiv2/types/retrieve_entity_types/retrieve_entity_types_traces_in_log.feature @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es +# +# author: 'Iván Arias León (ivan dot ariasleon at telefonica dot com)' + +# +# Note: the "skip" tag is to skip the scenarios that still are not developed or failed +# -tg=-skip +# + + +Feature: verify fields in log traces with retrieve entity types request using NGSI v2. + As a context broker user + I would like to verify fields in log traces with retrieve entity types request using NGSI v2 + So that I can manage and use them in my scripts + + Actions Before the Feature: + Setup: update properties test file from "epg_contextBroker.txt" and sudo local "false" + Setup: update contextBroker config file + Setup: start ContextBroker + Check: verify contextBroker is installed successfully + Check: verify mongo is installed successfully + + Actions After each Scenario: + Setup: delete database in mongo + + Actions After the Feature: + Setup: stop ContextBroker + + @traces_in_log + Scenario: verify log traces using NGSI v2 with retrieve entity types request + Given a definition of headers + | parameter | value | + | Fiware-Service | test_log_traces | + | Fiware-ServicePath | /test | + | Content-Type | application/json | + And initialize entity groups recorder + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | home | + | entities_id | room1 | + | attributes_number | 2 | + | attributes_name | temperature | + | attributes_value | 34 | + And create entity group with "5" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + And record entity group + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | house | + | entities_id | room2 | + | attributes_number | 2 | + | attributes_name | pressure | + | attributes_value | low | + And create entity group with "5" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + And record entity group + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_id | room3 | + | attributes_number | 2 | + | attributes_name | timestamp | + | attributes_value | 2017-06-17T07:21:24.238Z | + | attributes_type | date | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | random=10 | + And create entity group with "5" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + And record entity group + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | car | + | entities_id | vehicle | + | attributes_number | 2 | + | attributes_name | brake | + | attributes_value | 25 | + | attributes_type | seconds | + | metadatas_number | 2 | + | metadatas_name | very_hot | + | metadatas_type | alarm | + | metadatas_value | random=10 | + And create entity group with "5" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + And record entity group + # These properties below are used in create request + And properties to entities + | parameter | value | + | entities_type | car | + | entities_id | moto | + | attributes_number | 2 | + | attributes_name | speed | + | attributes_value | 45 | + | attributes_type | km_h | + And create entity group with "5" entities in "normalized" mode + | entity | prefix | + | id | true | + And verify that receive several "Created" http code + And record entity group + When get entity types + | parameter | value | + | options | count | + | limit | 2 | + | offset | 1 | + Then verify that receive an "OK" http code + And verify that entity types are returned in response are: "house,home" + And verify that attributes types are returned in response based on the info in the recorder + And verify headers in response + | parameter | value | + | x-total-count | 10 | + And check in log, label "INFO" and message "msg=logMsg.h[1803]: Starting transaction from" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | pending | + | subsrv | pending | + | from | pending | + | function | lmTransactionStart | + | comp | Orion | + And check in log, label "INFO" and message "msg=logMsg.h[1887]: Transaction ended" + | trace | value | + | time | ignored | + | trans | ignored | + | srv | test_log_traces | + | subsrv | /test | + | from | ignored | + | function | lmTransactionEnd | + | comp | Orion | From efda2e8c65181aeff45d7b5d9bd1789c0344e776 Mon Sep 17 00:00:00 2001 From: IVAN ARIAS LEON Date: Mon, 21 Mar 2016 11:57:58 +0100 Subject: [PATCH 13/13] [FIX] comments --- .../retrieve_entity/retrieve_entity_traces_in_log.feature | 1 + .../update_existing_entity_attributes.feature | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/acceptance/behave/components/ngsiv2/entities/retrieve_entity/retrieve_entity_traces_in_log.feature b/test/acceptance/behave/components/ngsiv2/entities/retrieve_entity/retrieve_entity_traces_in_log.feature index 427e07f63f..4df7fae4b6 100644 --- a/test/acceptance/behave/components/ngsiv2/entities/retrieve_entity/retrieve_entity_traces_in_log.feature +++ b/test/acceptance/behave/components/ngsiv2/entities/retrieve_entity/retrieve_entity_traces_in_log.feature @@ -53,6 +53,7 @@ Feature: verify fields in log traces with retrieve entity request using NGSI v2. | Fiware-Service | test_log_traces | | Fiware-ServicePath | /test | | Content-Type | application/json | + # These properties below are used in create request And properties to entities | parameter | value | | entities_type | house | diff --git a/test/acceptance/behave/components/ngsiv2/entities/update_existing_entity_attributes/update_existing_entity_attributes.feature b/test/acceptance/behave/components/ngsiv2/entities/update_existing_entity_attributes/update_existing_entity_attributes.feature index 6c4fa37aa5..094eaf1ef3 100644 --- a/test/acceptance/behave/components/ngsiv2/entities/update_existing_entity_attributes/update_existing_entity_attributes.feature +++ b/test/acceptance/behave/components/ngsiv2/entities/update_existing_entity_attributes/update_existing_entity_attributes.feature @@ -44,7 +44,7 @@ Feature: update attributes by entity ID if it exists using NGSI v2. "PATCH" - /v Setup: delete database in mongo Actions After the Feature: - #Setup: stop ContextBroker + Setup: stop ContextBroker @happy_path Scenario: update attributes by entity ID if it exists using NGSI v2