Commit d9993553 authored by Hamza Baqa's avatar Hamza Baqa

Include the semtest new F-interop updates

parent 1af42846
......@@ -40,11 +40,15 @@ sniff-bus: ## Listen and echo all messages in the event bus
stop-all:
@echo "Stop the SemTest cointainer"
docker stop easyglobalmarket-semtest
docker stop testingtool-semtest-ontology-validator
run-semtest-testing-tool: ## Run SemTest testing tool in docker container
testingtool-semtest-ontology-validator: ## Run SemTest testing tool in docker container
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
docker run -p 9093:8080 -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --env DOCKER_GW=$(DOCKER_GW) --name easyglobalmarket-semtest easyglobalmarket-semtest
docker run -p 9093:8080 -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --env DOCKER_GW=$(DOCKER_GW) --name testingtool-semtest-ontology-validator testingtool-semtest-ontology-validator
testingtool-semtest-test-manager: ## Run SemTest testing tool in docker container
@echo "Run the semtest test manager"
docker run -it --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --env DOCKER_GW=$(DOCKER_GW) --name testingtool-semtest-test-manager testingtool-semtest-test-manager
run-tests: ## runs all unittests
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
......@@ -66,7 +70,7 @@ _test_utils_conf:
python3 conf.py
_s2s_test:
python3 s2s.py
python3 s2s_copie.py
_test_utils:
python3 test.py
......@@ -90,12 +94,12 @@ _docker-build-semtest:
@echo "Starting to build SemTest testing tools.."
# let's build the testing tool image (same for interop and conformance)
docker build --quiet -t easyglobalmarket-semtest$(version) -f semtest/SemTest/Dockerfile .
#docker build --quiet -t easyglobalmarket-semtest-launcher$(version) -f semtest/SemTest_launcher/Dockerfile .
docker build --quiet -t testingtool-semtest-ontology-validator$(version) -f semtest/testingtool-semtest-ontology-validator/Dockerfile .
docker build -t testingtool-semtest-test-manager$(version) -f semtest/testingtool-semtest-test-manager/Dockerfile .
# tag all last version images also with a version-less name
docker tag easyglobalmarket-semtest$(version):latest easyglobalmarket-semtest
#docker tag easyglobalmarket-semtest-launcher$(version):latest easyglobalmarket-semtest-launcher
docker tag testingtool-semtest-ontology-validator$(version):latest testingtool-semtest-ontology-validator
docker tag testingtool-semtest-test-manager$(version):latest testingtool-semtest-test-manager
info_message = """ \\n\
......
......@@ -42,9 +42,13 @@ stop-all:
@echo "Stop the SemTest cointainer"
docker stop easyglobalmarket-semtest
run-semtest-testing-tool: ## Run SemTest testing tool in docker container
testingtool-semtest-ontology-validator: ## Run SemTest testing tool in docker container
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
docker run -p 9093:8080 -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --env DOCKER_GW=$(DOCKER_GW) --name easyglobalmarket-semtest easyglobalmarket-semtest
docker run -p 9093:8080 -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --env DOCKER_GW=$(DOCKER_GW) --name testingtool-semtest-ontology-validator testingtool-semtest-ontology-validator
testingtool-semtest-test-manager: ## Run SemTest testing tool in docker container
@echo "Run the semtest test manager"
docker run -p 9093:8080 -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --env DOCKER_GW=$(DOCKER_GW) --name testingtool-semtest-ontology-validator testingtool-semtest-ontology-validator
run-tests: ## runs all unittests
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
......@@ -58,9 +62,16 @@ run-conf-test: ## runs all unittests
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
$(MAKE) _test_utils_conf
run-s2s-test: ## runs all unittests
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
$(MAKE) _s2s_test
_test_utils_conf:
python3 conf.py
_s2s_test:
python3 s2s_copie.py
_test_utils:
python3 test.py
......@@ -70,6 +81,7 @@ _u2u_test:
install-python-dependencies: ## installs all python pip dependencies
@echo 'installing py3 dependencies...'
@python3 -m pip install ioppytest-utils --user
@python3 -m pip install validators
_check-sudo:
@runner=`whoami` ;\
......@@ -82,12 +94,12 @@ _docker-build-semtest:
@echo "Starting to build SemTest testing tools.."
# let's build the testing tool image (same for interop and conformance)
docker build --quiet -t easyglobalmarket-semtest$(version) -f semtest/SemTest/Dockerfile .
docker build --quiet -t easyglobalmarket-semtest-launcher$(version) -f semtest/SemTest_launcher/Dockerfile .
docker build --quiet -t testingtool-semtest-ontology-validator$(version) -f semtest/testingtool-semtest-ontology-validator/Dockerfile .
docker build --quiet -t testingtool-semtest-test-manager$(version) -f semtest/testingtool-semtest-test-manager/Dockerfile .
# tag all last version images also with a version-less name
docker tag easyglobalmarket-semtest$(version):latest easyglobalmarket-semtest
docker tag easyglobalmarket-semtest-launcher$(version):latest easyglobalmarket-semtest-launcher
docker tag testingtool-semtest-ontology-validator$(version):latest testingtool-semtest-ontology-validator
docker tag testingtool-semtest-test-manager$(version):latest testingtool-semtest-test-manager
info_message = """ \\n\
......
FROM tomcat:latest
COPY semtest/SemTest/SemTest.war $CATALINA_HOME/webapps/SemTest.war
FROM tomcat:latest
COPY semtest/testingtool-semtest-ontology-validator/SemTest.war $CATALINA_HOME/webapps/SemTest.war
FROM python:3
WORKDIR /usr/src/app
COPY semtest/testingtool-semtest-test-manager/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY semtest/testingtool-semtest-test-manager/conf.py .
COPY semtest/testingtool-semtest-test-manager/u2u.py .
COPY semtest/testingtool-semtest-test-manager/s2s.py .
COPY semtest/testingtool-semtest-test-manager/semtest_orchestrator.py .
ADD semtest/testingtool-semtest-test-manager/utils ./utils
ADD semtest/testingtool-semtest-test-manager/SPARQL ./SPARQL
ADD semtest/testingtool-semtest-test-manager/tmp ./tmp
CMD [ "python", "./semtest_orchestrator.py" ]
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY semtest/testingtool-semtest-test-manager/conf.py .
COPY semtest/testingtool-semtest-test-manager/u2u.py .
COPY semtest/testingtool-semtest-test-manager/s2s.py .
COPY semtest/testingtool-semtest-test-manager/semtest_orchestrator.py .
CMD [ "python", "./semtest_orchestrator.py" ]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -10,22 +10,33 @@ import json
print("The env vars are:")
DOCKER_GW = os.environ['DOCKER_GW']
#DOCKER_GW = os.environ['DOCKER_GW']
retval = os.getcwd() + "/tmp"
#call(["ioppytest-cli", "gui_request_file_upload",retval,"--text-message", "please upload file now :D"])
ioppytest_cli.gui_request_file_upload(retval+"/conf","please upload file now :D","")
file_to_validate_name = os.listdir(retval+"/conf")[1]
file_to_validate_path = retval + "/conf/" + file_to_validate_name
file_to_validate_name = os.listdir(retval+"/conf")
file_to_validate_name.remove('test')
file_to_validate_path = retval + "/conf/" + file_to_validate_name[0]
#Upload a the file
#URL_to_send = "http://"+DOCKER_GW+":9093/SemTest/ontology"
DOCKER_GW = os.environ['SEMTEST_ONTOLOGY_VALIDATOR_URL']
URL_to_send = DOCKER_GW + "/SemTest/ontology"
print("I will send the request to : " + URL_to_send)
#Upload a the file
URL_to_send = "http://"+DOCKER_GW+":9093/SemTest/ontology"
files = {'file': open(file_to_validate_path, 'rb')}
r = requests.post(URL_to_send, files=files)
print(r.text)
j = json.loads(r.text)
JSON_to_Send = json.dumps(
......@@ -43,7 +54,11 @@ JSON_to_Send = json.dumps(
ioppytest_cli._ui_display_markdown_text("Waiting for validation ............ ")
#send the file for validation
URL_to_send_validation = "http://"+os.environ['DOCKER_GW']+":9093/SemTest/ontology/test"
#URL_to_send_validation = "http://"+os.environ['DOCKER_GW']+":9093/SemTest/ontology/test"
DOCKER_GW = os.environ['SEMTEST_ONTOLOGY_VALIDATOR_URL']
URL_to_send_validation = DOCKER_GW + "/SemTest/ontology/test"
print("I will send the request to : " + URL_to_send + " for the validation")
res = requests.post(URL_to_send_validation, data=JSON_to_Send)
val = ast.literal_eval(res.text)
......
click==6.7
click_repl==0.1.2
pika==0.11.0
prompt_toolkit==1.0.15
six==1.11.0
wcwidth==0.1.7
requests==2.4.2
tabulate==0.8.2
\ No newline at end of file
......@@ -18,25 +18,6 @@ ui_reply = ioppytest_cli._amqp_request(req,'dummy_component')
session_user = ui_reply.users
session_user.remove('myslice')
ioppytest_cli.gui_request_file_upload(retval+"/sys1","please upload config file now :D", session_user[0])
ioppytest_cli.gui_request_file_upload(retval+"/sys2","please upload config file now :D", session_user[1])
list_of_files_1 = os.listdir(retval+"/sys1")
list_of_files_1.remove('test')
file_1_to_validate_name = list_of_files_1[0]
list_of_files_2 = os.listdir(retval+"/sys2")
list_of_files_2.remove('test')
file_2_to_validate_name = list_of_files_2[0]
file_1_to_validate_path = retval + "/sys1/" + file_1_to_validate_name
file_2_to_validate_path = retval + "/sys2/" + file_2_to_validate_name
print(file_1_to_validate_path)
print(file_2_to_validate_path)
ioppytest_cli._ui_display_markdown_text(".............Sending queries............ ")
......@@ -54,36 +35,47 @@ def is_http_url(s):
r'\[?[A-F0-9]*:[A-F0-9:]+\]?)' # ...or ipv6
r'(?:/?|[/?]\S+)$', re.IGNORECASE)
if re.match(regex,s):
return True
return False
else:
return False
def readConfigFile(conf):
filepath = conf
li = [] # ['IP','port']
with open(filepath) as fp:
line = fp.readline()
try:
if is_http_url(line.strip()):
li.append(line.strip())
line = fp.readline()
val = int(line.strip())
li.append(line.strip())
else:
ioppytest_cli._ui_display_markdown_text("Please check your config file: Line 1 is not a legal IP adress")
except ValueError:
ioppytest_cli._ui_display_markdown_text("Please check your config file: Line 2 is not a legal port")
return True
def is_port(s):
try:
int(s)
return False
except ValueError:
return True
def validate_return_inputs(user):
#get the IP
li=[]
ip= ioppytest_cli.gui_request_text("Please put the IP adress of your server",user)
port= ioppytest_cli.gui_request_text("Please put the port of your server",user)
while is_http_url(ip):
ioppytest_cli._ui_display_markdown_text("Please check your config file: Line 1 is not a legal IP adress")
ip = ioppytest_cli.gui_request_text("Please put the IP adress of your server",user)
li.append(ip)
while is_port(port):
ioppytest_cli._ui_display_markdown_text("Please check your config file: Line 2 is not a legal port")
port = ioppytest_cli.gui_request_text("Please put the port of your server",user)
li.append(port)
return li
queryScript = os.getcwd() + '/SPARQL/s-query'
#queryString = 'SELECT * {?s ?p ?o}'
queryString = 'SELECT * WHERE {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type}'
#Read config file 1
conf_li_1 = readConfigFile(file_1_to_validate_path)
#Read config file 1
conf_li_1 = []
user_inputs_1 = validate_return_inputs(session_user[0])
conf_li_1.append(user_inputs_1[0])
conf_li_1.append(user_inputs_1[1])
try:
resp_1 = subprocess.check_output([queryScript,'--service', conf_li_1[0] + ':' + conf_li_1[1] +'/ds/query',queryString])
query_resp_1 = json.loads(resp_1.decode("utf-8"))
......@@ -97,7 +89,10 @@ val_1_obj.append(query_resp_1)
#Read config file 2
conf_li_2 = readConfigFile(file_2_to_validate_path)
conf_li_2 = []
user_inputs_2 = validate_return_inputs(session_user[1])
conf_li_2.append(user_inputs_2[0])
conf_li_2.append(user_inputs_2[1])
try:
resp_2 = subprocess.check_output([queryScript,'--service', conf_li_2[0] + ':' + conf_li_2[1] +'/ds/query',queryString])
......@@ -118,10 +113,6 @@ else:
val_3_obj.append("Not Interoperable")
#Remove files
os.remove(file_1_to_validate_path)
os.remove(file_2_to_validate_path)
to_send = []
to_send.append(val_1_obj)
to_send.append(val_2_obj)
......
from utils.ioppytest_cli import ioppytest_cli
from collections import OrderedDict
import os
#ioppytest_cli._ui_display_markdown_text("Choose a test case:")
req = ioppytest_cli.MsgUiRequestSessionConfiguration()
ui_reply = ioppytest_cli._amqp_request(req,'dummy_component')
session_user = ui_reply.users
session_user.remove('myslice')
print("================= The users of the sessions : ========================" + str(len(session_user)))
if len(session_user) == 1:
os.system('python3 conf.py')
else:
ioppytest_cli._ui_display_markdown_text_orc("Choose a testcase scenario",session_user[0])
val = dict(ioppytest_cli._ui_send_question_with_choices(session_user[0]))
if 'User to User' in val:
os.system('python3 u2u.py')
elif 'SUT to SUT' in val:
os.system('python3 s2s.py')
\ No newline at end of file
......@@ -21,12 +21,17 @@ ioppytest_cli.gui_request_file_upload(retval+"/user2","please upload file now :D
file_1_to_validate_name = os.listdir(retval+"/user1")[1]
file_2_to_validate_name = os.listdir(retval+"/user2")[1]
file_1_to_validate_path = retval + "/user1/" + file_1_to_validate_name
file_2_to_validate_path = retval + "/user2/" + file_2_to_validate_name
URL_to_send = "http://"+os.environ['DOCKER_GW']+":9093/SemTest/ontology"
file_1_to_validate_name = os.listdir(retval+"/user1")
file_1_to_validate_name.remove('test')
file_2_to_validate_name = os.listdir(retval+"/user2")
file_2_to_validate_name.remove('test')
file_1_to_validate_path = retval + "/user1/" + file_1_to_validate_name[0]
file_2_to_validate_path = retval + "/user2/" + file_2_to_validate_name[0]
#URL_to_send = "http://"+os.environ['DOCKER_GW']+":9093/SemTest/ontology"
DOCKER_GW = os.environ['SEMTEST_ONTOLOGY_VALIDATOR_URL']
URL_to_send_validation = DOCKER_GW + "/SemTest/ontology"
print("I will send the file to URL_to_send_validation")
ioppytest_cli._ui_display_markdown_text("Waiting for validation ............ ")
......
......@@ -209,6 +209,60 @@ def gui_request_file_upload(path_to_file, text_message, user_id):
_save_file_from_base64(filename, value, path_to_file)
_echo_input("saved file {} in path {}".format(filename, path_to_file))
def gui_request_text(text_message, user_id):
"""
Request user to upload a file, saves it in directory (if provided) or else in .tmp
"""
global state
msg_request = MsgUiRequestTextInput()
msg_request.fields = [
{
"name": text_message,
"type": "text",
}
]
if user_id:
msg_request.routing_key = "ui.user.{}.request".format(user_id)
msg_request.reply_to = "ui.user.{}.reply".format(user_id)
_echo_input("sending request to {}".format(msg_request.routing_key))
msg_response = _amqp_request(msg_request, COMPONENT_ID, timeout=WAIT_TIME_FOR_USER_INPUT)
values_dict = msg_response.fields.pop()
userinput = values_dict[text_message]
_echo_input("The response is {}".format(userinput))
return userinput
def _ui_send_question_with_choices(user_id):
"""
Send button to GUI
"""
msg = MsgUiRequestQuestionRadio()
msg.fields = [{
"name": "User to User",
"type": "radio",
"value": True
},
{
"name": "SUT to SUT",
"type": "radio",
"value": True
}]
_echo_input("sending request to {}".format(msg.routing_key))
#_publish_message(msg)
if user_id:
msg.routing_key = "ui.user.{}.request".format(user_id)
msg.reply_to = "ui.user.{}.reply".format(user_id)
msg_response = _amqp_request(msg, COMPONENT_ID, timeout=WAIT_TIME_FOR_USER_INPUT)
values_dict = msg_response.fields.pop()
return values_dict
def gui_display_message(text_message, user_id):
"""
Sends message to GUI
......@@ -251,6 +305,30 @@ def _ui_display_markdown_text(text):
_publish_message(msg)
def _ui_display_markdown_text_orc(text,user_id):
"""
Send message to GUI
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
msg = MsgUiDisplayMarkdownText()
_echo_input(text)
if text:
fields = [
{
'type': 'p',
'value': text
}
]
msg.fields = fields
if user_id:
msg.routing_key = "ui.user.{}.display".format(user_id)
_publish_message(msg)
@cli.command()
def clear():
"""
......@@ -435,6 +513,8 @@ def ignore(message_type):
_echo_error(ke)
def enter_debug_context():
"""
(REPL only) Provides user with some extra debugging commands
......@@ -681,8 +761,7 @@ def enter_debug_context():
_echo_session_helper("Entering debugger context, added extra CMDs, please type --help for more info")
@cli.command()
@click.argument('message', nargs=-1)
def chat(message):
"""
Send chat message, useful for user-to-user test sessions
......@@ -777,6 +856,7 @@ def _echo_context():
_echo_list_as_table(table)
def _set_up_connection(create_listener=True, lazy_listener=False):
# conn for repl publisher
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment