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
e84e36cf
Commit
e84e36cf
authored
Nov 05, 2020
by
Bogdan
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into bugfix/traceIdDeduplication
parents
4e2e062c
52f64f8d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
74 additions
and
57 deletions
+74
-57
testing.py
bin/testing.py
+1
-1
__init__.py
src/__init__.py
+0
-0
__init__.py
src/data-hub/__init__.py
+0
-0
__init__.py
src/data-hub/semantic-linking-microservice/__init__.py
+0
-0
__init__.py
src/data-hub/semantic-linking-microservice/app/__init__.py
+0
-0
main.py
src/data-hub/semantic-linking-microservice/app/main.py
+2
-1
MessageHandler.py
...ntic-linking-microservice/app/messaging/MessageHandler.py
+2
-3
test_pipeline.py
.../semantic-linking-microservice/app/tests/test_pipeline.py
+27
-2
test_layer_adapter.py
...siness-logic-microservice/app/tests/test_layer_adapter.py
+1
-1
pizza_transactions.json
src/rest-gateway/app/tests/pizza_transactions.json
+41
-0
test_insert_pizza.py
src/rest-gateway/app/tests/test_insert_pizza.py
+0
-44
test_by.py
...-hub-in/trace-retrieval-microservice/app/tests/test_by.py
+0
-5
No files found.
bin/testing.py
View file @
e84e36cf
...
...
@@ -10,7 +10,7 @@ It additionally installs all dependencies from a '../requirements.txt' via pip.
Use command line argument '-w' to run on windows.
'''
PY
=
'py'
if
(
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
'-w'
)
else
'python3.7'
# use -w to run on windows
PY
=
sys
.
argv
[
2
]
if
(
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
'-py'
)
else
'python3.7'
# use -py to use your own python command
ROOT
=
pathlib
.
Path
(
__file__
)
.
parent
.
parent
.
absolute
()
TESTS_FOLDER_NAME
=
os
.
path
.
normpath
(
"/tests"
)
...
...
src/__init__.py
deleted
100644 → 0
View file @
4e2e062c
src/data-hub/__init__.py
deleted
100644 → 0
View file @
4e2e062c
src/data-hub/semantic-linking-microservice/__init__.py
deleted
100644 → 0
View file @
4e2e062c
src/data-hub/semantic-linking-microservice/app/__init__.py
deleted
100644 → 0
View file @
4e2e062c
src/data-hub/semantic-linking-microservice/app/main.py
View file @
e84e36cf
...
...
@@ -21,7 +21,8 @@ from messaging.ReconnectingMessageManager import ReconnectingMessageManager
from
messaging.MessageHandler
import
MessageHandler
# init message handler
message_handler
=
MessageHandler
()
from
db.repository
import
Repository
message_handler
=
MessageHandler
(
Repository
())
def
message_received_callback
(
channel
,
method
,
properties
,
body
):
message_handler
.
handle_generic
(
body
)
...
...
src/data-hub/semantic-linking-microservice/app/messaging/MessageHandler.py
View file @
e84e36cf
import
network_constants
as
netconst
from
security.token_manager
import
TokenManager
from
db.entities
import
Layer
from
db.repository
import
Repository
import
json
import
requests
...
...
@@ -12,8 +11,8 @@ import logging
LOGGER
=
logging
.
getLogger
(
__name__
)
class
MessageHandler
:
def
__init__
(
self
):
self
.
_repository
=
Repository
()
def
__init__
(
self
,
repository
):
self
.
_repository
=
repository
def
handle_generic
(
self
,
body
):
LOGGER
.
info
(
f
"Received message: {body}"
)
...
...
src/data-hub/semantic-linking-microservice/app/tests/test_pipeline.py
View file @
e84e36cf
...
...
@@ -2,15 +2,40 @@ import unittest
import
manage_sys_paths
import
json
from
db.repository
import
Repository
from
db.entities.layer
import
Layer
from
messaging.MessageHandler
import
MessageHandler
from
messaging.DummyMessageManager
import
DummyMessageManager
as
DummyMessageSender
from
typing
import
List
class
DummyMongoRepo
:
'''Dummy class to be used for testing the MessageHandler'''
last_trace
=
None
DBnodes
=
[]
def
insert_trace
(
self
,
trace
):
self
.
last_trace
=
trace
def
delete_layer
(
self
,
layer
):
pass
def
add_layer
(
self
,
layer
):
pass
def
get_layers_for_use_case_and_table
(
self
,
use_case
,
table
):
return
[
Layer
(
layer_info
=
{
"layer_name"
:
"pizza_layer_test"
,
"properties"
:
[
"UniqueID"
],
"total_properties"
:
[
"UniqueID"
],
"use_case"
:
"debug"
,
"table"
:
"pizza"
}
)
]
def
add_layer_nodes
(
self
,
nodes
:
List
):
pass
def
get_layers_for_use_case_and_table
(
use_case
,
table
):
...
...
@@ -86,7 +111,7 @@ class Test_Pipeline(unittest.TestCase):
def
setUp
(
self
):
self
.
repo
=
DummyMongoRepo
()
self
.
msg_sender
=
DummyMessageSender
.
get_instance
()
self
.
handler
=
MessageHandler
()
self
.
handler
=
MessageHandler
(
self
.
repo
)
def
_buildTraceMessage
(
self
):
return
{
...
...
src/participation-hub/business-logic-microservice/app/tests/test_layer_adapter.py
View file @
e84e36cf
import
unittest
#
import manage_sys_paths
import
manage_sys_paths
from
db.entities.layer_adapter
import
LayerAdapter
...
...
src/rest-gateway/app/tests/pizza_transactions.json
0 → 100644
View file @
e84e36cf
[
{
"type"
:
"blockchain-transaction"
,
"ApplicationType"
:
"debug"
,
"docType"
:
"order"
,
"orderId"
:
1
,
"pizza"
:
1
,
"price"
:
12.0
,
"restaurant"
:
1
},
{
"type"
:
"blockchain-transaction"
,
"ApplicationType"
:
"debug"
,
"docType"
:
"pizza"
,
"id"
:
1
,
"name"
:
"Diavolo"
,
"dough"
:
{
"type"
:
"wheat"
,
"spinach"
:
false
},
"toppings"
:
[
{
"name"
:
"Tomato Sauce"
,
"price"
:
1.00
},
{
"name"
:
"Cheese"
,
"price"
:
0.50
},
{
"name"
:
"Chilli Oil"
,
"price"
:
0.50
},
{
"name"
:
"Peppers"
,
"price"
:
1.50
}
]
}
]
src/rest-gateway/app/tests/test_insert_pizza.py
deleted
100644 → 0
View file @
4e2e062c
import
unittest
import
manage_sys_paths
from
messaging.DummyMessageManager
import
DummyMessageManager
# init dummy message manager so no connection to rabbitmq is established
_
=
DummyMessageManager
.
get_instance
()
import
routes.blockchain_trace
as
blockchain_trace
from
env_info
import
get_resources_path
from
security.token_manager
import
TokenManager
import
network_constants
import
json
import
requests
class
Test_BlockchainTrace
(
unittest
.
TestCase
):
def
test_isBlockchainTraceValid_validInputAndTypes
(
self
):
with
open
(
f
"{get_resources_path()}/pizza_transactions.json"
)
as
f
:
transactions
=
json
.
loads
(
f
.
read
())
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
for
transaction
in
transactions
:
url
=
f
'https://{network_constants.REST_GATEWAY_HOSTNAME}:{network_constants.REST_GATEWAY_REST_PORT}/api/trace'
response
=
requests
.
post
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
transaction
)
print
(
f
"{url} {response.status_code}"
)
if
response
.
status_code
!=
201
:
print
(
f
"server responded with {response.status_code}: {response.text}"
)
self
.
assertTrue
(
response
.
status_code
==
201
,
"Should accept the new trace."
)
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
src/transaction-hub-in/trace-retrieval-microservice/app/tests/test_by.py
View file @
e84e36cf
...
...
@@ -76,11 +76,6 @@ class Test_MessageHandler(unittest.TestCase):
}
}
return
json
.
dumps
(
message_values
)
def
test_HandlePizzaMessage
(
self
):
msg
=
self
.
_get_pizza_message
()
_
=
self
.
handler
.
handle_blockchain_transaction
(
json
.
loads
(
msg
)[
"content"
])
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
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