Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
0f7bfca8
Commit
0f7bfca8
authored
Mar 31, 2021
by
Manuel Herold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[traceRetrieval] implemented enum parsing
parent
b38aa85f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
150 additions
and
75 deletions
+150
-75
sample_trace.json
...service/app/_add_use_case_scripts/debug/sample_trace.json
+16
-0
add_pizza_table.py
...app/_add_use_case_scripts/debug/tables/add_pizza_table.py
+4
-2
MessageHandler.py
...ce-retrieval-microservice/app/messaging/MessageHandler.py
+98
-66
rest_fetcher.py
...race-retrieval-microservice/app/messaging/rest_fetcher.py
+32
-7
No files found.
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/debug/sample_trace.json
0 → 100644
View file @
0f7bfca8
{
"ApplicationType"
:
"debug"
,
"docType"
:
"pizza"
,
"id"
:
1
,
"dough"
:
{
"type"
:
"wheat"
,
"spinach"
:
false
},
"toppings"
:
[
{
"name"
:
"cheese"
,
"price"
:
0.99
}
],
"name"
:
"Margherita"
}
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/debug/tables/add_pizza_table.py
View file @
0f7bfca8
...
@@ -64,6 +64,7 @@ def main(use_case: str):
...
@@ -64,6 +64,7 @@ def main(use_case: str):
{
{
"UniqueID"
:
"id"
,
"UniqueID"
:
"id"
,
"name"
:
"name"
,
"name"
:
"name"
,
"nameIndex"
:
"enum(name)"
,
"doughType"
:
"dough//type"
,
"doughType"
:
"dough//type"
,
"hasSpinach"
:
"dough//spinach"
,
"hasSpinach"
:
"dough//spinach"
,
"firstTopping"
:
"toppings[0]//name"
,
"firstTopping"
:
"toppings[0]//name"
,
...
@@ -81,10 +82,11 @@ def main(use_case: str):
...
@@ -81,10 +82,11 @@ def main(use_case: str):
"name"
:
"Price_Layer"
,
"name"
:
"Price_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"firstToppingPrice"
"firstToppingPrice"
,
"nameIndex"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"firstToppingPrice"
"firstToppingPrice"
,
]
]
},
},
{
{
...
...
src/transaction-hub-in/trace-retrieval-microservice/app/messaging/MessageHandler.py
View file @
0f7bfca8
This diff is collapsed.
Click to expand it.
src/transaction-hub-in/trace-retrieval-microservice/app/messaging/rest_fetcher.py
View file @
0f7bfca8
...
@@ -2,23 +2,48 @@ from security.token_manager import TokenManager
...
@@ -2,23 +2,48 @@ from security.token_manager import TokenManager
import
network_constants
import
network_constants
from
typing
import
List
from
typing
import
List
import
json
,
requests
import
json
import
requests
class
RestFetcher
:
class
RestFetcher
:
def
fetch_enum_value
(
self
,
use_case
:
str
,
table
:
str
,
enum_name
:
str
,
enum_value
:
str
)
->
int
:
jwt_token
=
TokenManager
.
getInstance
()
.
getToken
()
url
=
f
'https://{network_constants.BUSINESS_LOGIC_HOSTNAME}:{network_constants.BUSINESS_LOGIC_REST_PORT}/api/use-cases/{use_case}/tables/{table}/enum/{enum_name}?value={enum_value}'
print
(
f
"calling {url}"
)
# query tables for use-case
url
=
url
response
=
requests
.
put
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt_token}"
},
)
if
response
.
status_code
!=
200
:
raise
ValueError
(
f
"Error while retrieving Enum information.
\t
Status-code:{response.status_code}"
)
enum
=
json
.
loads
(
response
.
text
)
return
enum
[
"index"
]
def
fetch_schema_information
(
self
,
use_case
:
str
)
->
List
:
def
fetch_schema_information
(
self
,
use_case
:
str
)
->
List
:
jwt_token
=
TokenManager
.
getInstance
()
.
getToken
()
jwt_token
=
TokenManager
.
getInstance
()
.
getToken
()
# query tables for use-case
# query tables for use-case
url
=
f
'https://{network_constants.BUSINESS_LOGIC_HOSTNAME}:{network_constants.BUSINESS_LOGIC_REST_PORT}/api/use-cases/{use_case}/tables'
url
=
f
'https://{network_constants.BUSINESS_LOGIC_HOSTNAME}:{network_constants.BUSINESS_LOGIC_REST_PORT}/api/use-cases/{use_case}/tables'
response
=
requests
.
get
(
response
=
requests
.
get
(
url
,
url
,
verify
=
False
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt_token}"
}
headers
=
{
"Authorization"
:
f
"Bearer {jwt_token}"
}
)
)
if
response
.
status_code
!=
200
:
if
response
.
status_code
!=
200
:
raise
ValueError
(
f
"Error while retrieving schema information.
\t
Status-code:{response.status_code}"
)
raise
ValueError
(
f
"Error while retrieving schema information.
\t
Status-code:{response.status_code}"
)
tables
=
json
.
loads
(
response
.
text
)
tables
=
json
.
loads
(
response
.
text
)
return
tables
return
tables
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment