diff --git a/services/data-graph/test-empty-abstract.tar.gz b/services/data-graph/test-empty-abstract.tar.gz new file mode 100644 index 00000000..61c0dacc Binary files /dev/null and b/services/data-graph/test-empty-abstract.tar.gz differ diff --git a/services/data-graph/tests.hurl b/services/data-graph/tests.hurl index 11530814..32fa8367 100644 --- a/services/data-graph/tests.hurl +++ b/services/data-graph/tests.hurl @@ -2,6 +2,11 @@ # DON'T OVERWRITE IT # Use it to test: # npx hurl --test data-computer/tests.hurl +# Use it to test: +# HURL_blocked=false npx hurl --test --variable host="http://localhost:31976" tests.hurl +# or (from root of the repo) +# HURL_blocked=false npm run test:local data-graph + POST {{host}}/v1/graph content-type: application/x-tar @@ -107,3 +112,61 @@ jsonpath "$[*].value['viz$size'].value" exists jsonpath "$[*].value['viz$position'].x" exists jsonpath "$[*].value['viz$position'].y" exists jsonpath "$[*].value['viz$position'].z" exists + + +# ------------------------------ +POST {{host}}/v1/teeft-graph +content-type: application/x-tar +x-hook: https://webhook.site/69300b22-a251-4c16-9905-f7ba218ae7e9 +[Options] +skip: {{blocked}} +file,test-empty-abstract.tar.gz; + +HTTP 200 +# Capture the computing token +[Captures] +computing_token: jsonpath "$[0].value" +[Asserts] +variable "computing_token" exists + +POST {{host}}/v1/retrieve-json +content-type: application/json +[Options] +delay: 40000 +skip: {{blocked}} +``` +[ + { + "value":"{{computing_token}}" + } +] +``` + +HTTP 200 +Content-Type: application/json +[Asserts] + +jsonpath "$" count > 0 + +jsonpath "$[*].id" exists + +jsonpath "$[*].value" exists +jsonpath "$[*].value.label" exists + +jsonpath "$[*].attributes.weight" exists +jsonpath "$[*].attributes.subset" exists + +jsonpath "$[0].value.targets[0].id" exists +jsonpath "$[0].value.targets[1].id" exists +jsonpath "$[0].value.targets[1].thickness" exists + +jsonpath "$[*].value['viz$color'].r" exists +jsonpath "$[*].value['viz$color'].g" exists +jsonpath "$[*].value['viz$color'].b" exists +jsonpath "$[*].value['viz$color'].a" exists + +jsonpath "$[*].value['viz$size'].value" exists + +jsonpath "$[*].value['viz$position'].x" exists +jsonpath "$[*].value['viz$position'].y" exists +jsonpath "$[*].value['viz$position'].z" exists \ No newline at end of file diff --git a/services/data-graph/v1/graph.py b/services/data-graph/v1/graph.py index b14d1c19..898d0e02 100755 --- a/services/data-graph/v1/graph.py +++ b/services/data-graph/v1/graph.py @@ -12,12 +12,22 @@ # load all datas lines = [] +pid = "" for line in sys.stdin: data = json.loads(line) - if not len(lines): - pid = data[[x for x in list(data.keys()) if x.startswith("PID")][0]][5:] + print("Received data: ", data, file=sys.stderr) + if pid == "": + keys = data.keys() + for k in keys: + if k.startswith("PID"): + pid = data[k][5:] + break lines.append(data["value"]) + + # if pid == "" and data["value"] != []: + # pid = data[[x for x in list(data.keys()) if x.startswith("PID")][0]][5:] + print("PID ",pid, file=sys.stderr) print(time.strftime("%A %d %B %Y %H:%M:%S"), file=sys.stderr) keyword = [] diff --git a/services/data-graph/v1/retrieve-gexf-and-img.ini b/services/data-graph/v1/retrieve-gexf-and-img.ini index cbb3cbc3..76a52e10 100644 --- a/services/data-graph/v1/retrieve-gexf-and-img.ini +++ b/services/data-graph/v1/retrieve-gexf-and-img.ini @@ -6,7 +6,7 @@ extension = tar.gz post.operationId = post-v1-retrieve-gexf&img post.summary = Récupération du résultat sous format xml/gexf et png, dans un tar.gz. Pour utiliser le fichier gexf, assurez-vous de changer l'extension en `.gexf`. post.description = Récupération du résultat sous format xml/gexf et png, dans un tar.gz. Pour utiliser le fichier gexf, assurez-vous de changer l'extension en `.gexf`. -post.tags.0 = data-graph +post.tags.0 = retrieves post.responses.default.description = Fichier corpus au format tar.gz post.responses.default.content.application/x-gzip.schema.type = string post.responses.default.content.application/x-gzip.schema.format = binary diff --git a/services/data-graph/v1/retrieve-gexf.ini b/services/data-graph/v1/retrieve-gexf.ini index 6f3faa8b..91ca22f3 100644 --- a/services/data-graph/v1/retrieve-gexf.ini +++ b/services/data-graph/v1/retrieve-gexf.ini @@ -6,7 +6,7 @@ extension = gexf post.operationId = post-v1-retrieve-gexf post.summary = Récupération d'un résultat produit sous forme d'un XML / GEXF post.description = Les traitements étant asynchrones le résultat, une fois créé, doit être récupéré par cette route. Pour l'utiliser, assurez-vous de changer l'extension en `.gexf` -post.tags.0 = data-graph +post.tags.0 = retrieves post.responses.default.description = Fichier graphe au format GEXF post.requestBody.required = true diff --git a/services/data-graph/v1/retrieve-img.ini b/services/data-graph/v1/retrieve-img.ini index 203ad69e..0a0a6426 100644 --- a/services/data-graph/v1/retrieve-img.ini +++ b/services/data-graph/v1/retrieve-img.ini @@ -5,7 +5,7 @@ mimeType = image/png post.operationId = post-v1-retrieve-img post.description = Récupération d'un résultat produit sous forme d'un fichier image post.summary = Récupération d'un résultat produit sous forme d'un fichier image -post.tags.0 = data-graph +post.tags.0 = retrieves post.responses.default.description = Fichier image au format PNG post.requestBody.content.application/json.example.0.value = xMkWJX7GU post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream diff --git a/services/data-graph/v1/retrieve-json.ini b/services/data-graph/v1/retrieve-json.ini index 3f534328..813d0bc1 100644 --- a/services/data-graph/v1/retrieve-json.ini +++ b/services/data-graph/v1/retrieve-json.ini @@ -6,7 +6,7 @@ post.operationId = post-v1-retrieve-json post.summary = Récupération d'un résultat produit sous forme d'un JSON GEXF post.description = Renvoie la version au format JSON d'un fichier GEXF produit par un traitement asynchrone. #' -post.tags.0 = data-graph +post.tags.0 = retrieves post.responses.default.description = Fichier graphe GEXF au format JSON post.requestBody.required = true diff --git a/services/data-graph/v1/retrieve-status.ini b/services/data-graph/v1/retrieve-status.ini index 642c9871..7707d57c 100644 --- a/services/data-graph/v1/retrieve-status.ini +++ b/services/data-graph/v1/retrieve-status.ini @@ -6,7 +6,7 @@ extension = jsonl post.operationId = post-v1-retrieve post.summary = Récupération du status d'un traitement post.description = Les traitements étant asynchrones le status du traitement peut-être récupéré par cette route -post.tags.0 = data-graph +post.tags.0 = retrieves post.responses.default.description = Fichier corpus au format jsonl post.responses.default.content.application/jsonl.schema.type = string post.requestBody.content.application/json.example.0.value = xMkWJX7GU diff --git a/services/data-graph/v1/retrieve.ini b/services/data-graph/v1/retrieve.ini index df3bf632..b345efae 100644 --- a/services/data-graph/v1/retrieve.ini +++ b/services/data-graph/v1/retrieve.ini @@ -6,7 +6,7 @@ extension = tar.gz post.operationId = post-v1-retrieve post.summary = Récupération d'un résultat produit sous forme d'un fichier corpus post.description = Les traitements étant asynchrones le résultat une fois créé doit être récupéré par cette route -post.tags.0 = data-graph +post.tags.0 = retrieves post.responses.default.description = Fichier corpus au format tar.gz post.responses.default.content.application/x-gzip.schema.type = string post.responses.default.content.application/x-gzip.schema.format = binary