aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2/testcases/resources/DMaaP.py
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-07-29 11:13:36 +0200
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-07-29 12:19:21 +0200
commita926d94469780de763da510c9cc01b768df2e444 (patch)
tree1f25b961784672c3f1f7ac71f2829743fcbc8e41 /tests/dcaegen2/testcases/resources/DMaaP.py
parent7a51eafe2231b2719cb842e6407ce3178d617268 (diff)
Add topic validation for dcaegen2 VES tests
Issue-ID: DCAEGEN2-1771 Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> Change-Id: Ifb4f0f01ef3dcda366147d32c98a9be7890b6f56
Diffstat (limited to 'tests/dcaegen2/testcases/resources/DMaaP.py')
-rw-r--r--tests/dcaegen2/testcases/resources/DMaaP.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/dcaegen2/testcases/resources/DMaaP.py b/tests/dcaegen2/testcases/resources/DMaaP.py
index 500afd5d..4c245614 100644
--- a/tests/dcaegen2/testcases/resources/DMaaP.py
+++ b/tests/dcaegen2/testcases/resources/DMaaP.py
@@ -106,14 +106,16 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
'''
if resp_code == 0:
+ topic = self.extract_topic_from_path()
content_len = int(self.headers.getheader('content-length', 0))
post_body = self.rfile.read(content_len)
indx = post_body.index("{")
if indx != 0:
post_body = post_body[indx:]
-
- if not enque_event(post_body):
+
+ event = "\""+topic+"\":" + post_body
+ if not enque_event(event):
print "enque event fails"
global EvtSchema
@@ -180,6 +182,9 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
'''
return
+ def extract_topic_from_path(self):
+ return self.path["/events/".__len__():]
+
def do_GET(self):
"""Serve a GET request."""
f = self.send_head()