diff --git a/extensions/__old__mockserverlibrary.patch b/extensions/__old__mockserverlibrary.patch deleted file mode 100644 index 117fee00e3e41c88421fb2cbedd114fd8697378d..0000000000000000000000000000000000000000 --- a/extensions/__old__mockserverlibrary.patch +++ /dev/null @@ -1,75 +0,0 @@ -diff --git a/src/MockServerLibrary/library.py b/src/MockServerLibrary/library.py -index a9e6227..7208e61 100644 ---- a/src/MockServerLibrary/library.py -+++ b/src/MockServerLibrary/library.py -@@ -68,6 +68,31 @@ class MockServerLibrary(object): - - return req - -+ def create_mock_request_matcher_schema(self, method, path, body_type='JSON_SCHEMA', body=None): -+ """Creates a mock request matcher to be used by mockserver. -+ -+ Returns the request matcher in a dictionary format. -+ -+ `method` is the HTTP method of the mocked endpoint -+ -+ `path` is the url of the mocked endpoint, e.g. /api -+ -+ `body_type` is the type of the request body, e.g. JSON -+ -+ `body` is a dictionary of the json attribute(s) to match -+ -+ `exact` is a boolean value which specifies whether the body should match fully (=true), -+ or if only specified fields should match (=false) -+ """ -+ req = {} -+ req['method'] = method -+ req['path'] = path -+ -+ req['body'] = {'type': body_type, 'jsonSchema': json.dumps(body)} -+ -+ return req -+ -+ - def create_mock_response(self, status_code, headers=None, body_type='JSON', body=None): - """Creates a mock response to be used by mockserver. - -@@ -97,6 +122,37 @@ class MockServerLibrary(object): - - return rsp - -+ -+ def create_mock_response_schema(self, status_code, headers=None, body_type='JSON_SCHEMA', body=None): -+ """Creates a mock response to be used by mockserver. -+ -+ Returns the response in a dictionary format. -+ -+ `status_code` is the HTTP status code of the response -+ -+ `headers` is a dictionary of headers to be added to the response -+ -+ `body_type` is the type of the response body, e.g. JSON -+ -+ `body` is a dictonary of JSON attribute(s) to be added to the response body -+ """ -+ rsp = {} -+ rsp['statusCode'] = int(status_code) -+ -+ if headers: -+ rsp['headers'] = [] -+ -+ for key, value in headers.items(): -+ header = {'name': key, 'values': value.split(",")} -+ rsp['headers'].append(header) -+ logger.debug("Add header - header: {}".format(header)) -+ -+ if body_type is 'JSON_SCHEMA' and body: -+ rsp['body'] = json.dumps(body) -+ -+ return rsp -+ -+ - def create_mock_expectation(self, request, response, count=1, unlimited=True): - """Creates a mock expectation to be used by mockserver. - - diff --git a/extensions/jsonlibrary.patch b/extensions/jsonlibrary.patch deleted file mode 100644 index 39d454a3d184ba70a3ddb3cf7130d3ebf7b0ab09..0000000000000000000000000000000000000000 --- a/extensions/jsonlibrary.patch +++ /dev/null @@ -1,59 +0,0 @@ -diff --git a/JSONLibrary/JSONLibraryKeywords.py b/JSONLibrary/JSONLibraryKeywords.py -index 6ceb6e1..20bfd45 100644 ---- a/JSONLibrary/JSONLibraryKeywords.py -+++ b/JSONLibrary/JSONLibraryKeywords.py -@@ -1,7 +1,13 @@ - # -*- coding: utf-8 -*- - from robot.api import logger - from robot.api.deco import keyword --from version import VERSION -+#from version import VERSION -+try: -+ from version import VERSION -+except: -+ from JSONLibrary.version import VERSION -+ -+ - import os.path - import json - from jsonpath_rw import Index, Fields -diff --git a/JSONLibrary/__init__.py b/JSONLibrary/__init__.py -index efc756e..79ad728 100644 ---- a/JSONLibrary/__init__.py -+++ b/JSONLibrary/__init__.py -@@ -1,6 +1,12 @@ - # -*- coding: utf-8 -*- --from JSONLibraryKeywords import JSONLibraryKeywords --from version import VERSION -+# from JSONLibraryKeywords import JSONLibraryKeywords -+# from version import VERSION -+try: -+ from JSONLibraryKeywords import JSONLibraryKeywords -+ from version import VERSION -+except: -+ from JSONLibrary.JSONLibraryKeywords import JSONLibraryKeywords -+ from JSONLibrary.version import VERSION - - __author__ = 'Traitanit Huangsri' - __email__ = 'traitanit.hua@gmail.com' -diff --git a/setup.py b/setup.py -index 744e6f5..5082364 100644 ---- a/setup.py -+++ b/setup.py -@@ -2,7 +2,15 @@ - # -*- coding: utf-8 -*- - - from setuptools import setup --from JSONLibrary.version import VERSION -+# from JSONLibrary.version import VERSION -+ -+ -+# importing this has the unwanted side-effect of importing -+# other required packages that may not be installed yet -+# resulting in an error -+#from JSONLibrary.version import VERSION -+ -+VERSION = '0.2' - - requirements = [ - 'tox', diff --git a/extensions/mockserverlibrary.patch b/extensions/mockserverlibrary.patch deleted file mode 100644 index 8097a9d0dd924a57b59d40d73513c806415979bf..0000000000000000000000000000000000000000 --- a/extensions/mockserverlibrary.patch +++ /dev/null @@ -1,59 +0,0 @@ -diff --git a/src/MockServerLibrary/library.py b/src/MockServerLibrary/library.py -index a9e6227..7ba1eed 100644 ---- a/src/MockServerLibrary/library.py -+++ b/src/MockServerLibrary/library.py -@@ -66,6 +66,9 @@ class MockServerLibrary(object): - match_type = 'STRICT' if exact else 'ONLY_MATCHING_FIELDS' - req['body'] = {'type': body_type, 'json': json.dumps(body), 'matchType': match_type} - -+ if body_type is 'JSON_SCHEMA' and body: -+ req['body'] = {'type': body_type, 'json': json.dumps(body)} -+ - return req - - def create_mock_response(self, status_code, headers=None, body_type='JSON', body=None): -@@ -97,6 +100,42 @@ class MockServerLibrary(object): - - return rsp - -+ def create_mock_http_forward(self, path, delay=1, unit='SECONDS'): -+ """Creates a mock http override forward to be used by mockserver. -+ -+ Returns the http forward in a dictionary format. -+ -+ `path` is the new url where to forward the request -+ -+ `delay` is the delay of the forward action -+ -+ `unit` is the unit of the delay time (default "SECONDS") -+ """ -+ fwd = {} -+ fwd['httpRequest'] = {'path': path} -+ fwd['delay'] = {'timeUnit': unit, 'value': delay} -+ -+ return fwd -+ -+ def create_mock_expectation_with_http_forward(self, request, forward, count=1, unlimited=True): -+ """Creates a mock expectation with request and forward action to be used by mockserver. -+ -+ `request` is a mock request matcher in a dictionary format. -+ -+ `forward` is a mock forward in a dictionary format. -+ -+ `count` is the number of expected requests -+ -+ `unlimited` is a boolean value which, if enabled, allows unspecified number of -+ requests to reply to -+ """ -+ data = {} -+ data['httpRequest'] = request -+ data['httpOverrideForwardedRequest'] = forward -+ data['times'] = {'remainingTimes': int(count), 'unlimited': unlimited} -+ -+ self.create_mock_expectation_with_data(data) -+ - def create_mock_expectation(self, request, response, count=1, unlimited=True): - """Creates a mock expectation to be used by mockserver. - - - diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4f00299b7ec3c17280e3269345fe687d2d7815e7..0000000000000000000000000000000000000000 --- a/requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -## To install the libraries, use: -# pip -r requirements.txt - -git+https://github.com/etsi-cti-admin/RESTinstance -robotframework==3.1 -#RESTinstance==1.0.0rc4 -robotframework-dependencylibrary==1.0.0.post1 -robotframework-jsonlibrary==0.3 -robotframework-jsonschemalibrary==1.0 -robotframework-mockserver==0.0.7 -robotframework-requests==0.7.1 diff --git a/scripts/build-container.sh b/scripts/build-container.sh deleted file mode 100644 index f5c825ad9b06585a6b1aff2191c5df9ef18a3f7b..0000000000000000000000000000000000000000 --- a/scripts/build-container.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# Copyright ETSI 2019 -# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt - -#set -e -set -vx - -DOCKER_FILE=./scripts/docker/Dockerfile -if [ -f ${DOCKER_FILE} ] -then - #check and build stf583-rf-validation image - DOCKER_ID=`docker ps -a | grep -e stf583-rf-validation | awk '{ print $1 }'` -# if [ ! -z "${DOCKER_ID}" ] -# then -# docker rm --force stf583-rf-validation -# fi - docker build --tag stf583-rf-validation -f ${DOCKER_FILE} . - if [ "$?" != "0" ] - then - echo "Docker build failed: $?" - exit -1 - fi -# docker image ls -a -# docker inspect stf583-rf-validation:latest -# if [ "$?" != "0" ] -# then -# echo "Docker inspect failed: $?" -# exit -2 -# fi -#else -# exit -3 -fi - -# That's all Floks -exit 0 - diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile deleted file mode 100644 index 9f082157bc7b1e5c57c486bc7d932e86f7177057..0000000000000000000000000000000000000000 --- a/scripts/docker/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -FROM ubuntu:18.04 - -MAINTAINER ETSI STF 583 - -LABEL description="SFT583 Robot Framework Docker Image" - -ENV TERM=xterm -ENV HOSTNAME docker-robot-STF583 - -ARG ssh_prv_key - -RUN DEBIAN_FRONTEND=noninteractive apt update \ - && apt install python3 git -y \ - && apt install python3-pip -y \ - && DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y \ - && DEBIAN_FRONTEND=noninteractive apt-get autoclean \ - && rm -rf /var/lib/apt/lists/* - -RUN echo "docker-robot-STF583" > /etc/hostname \ - && echo "root:etsi" | chpasswd - -RUN useradd --create-home --shell /bin/bash --user-group etsi --groups sudo \ - && echo "etsi:etsi" | chpasswd \ - && adduser etsi sudo \ - && echo "etsi ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers - -RUN DEBIAN_FRONTEND=noninteractive \ - && mkdir -p /home/etsi/dev/robot \ - && cd /home/etsi/dev/robot - -#RUN pip3 install robotframework - -ADD requirements.txt /home/etsi/dev/robot/ -ADD extensions /home/etsi/dev/robot/extensions - -RUN ls /home/etsi/dev/robot - -#To avoid to use the cache when new commits are available -ADD "https://forge.etsi.org/rep/api/v4/projects/224/repository/branches/master" /tmp/devalidateCache - -RUN DEBIAN_FRONTED=noninteractive \ - cd /home/etsi/dev/ \ - mkdir -p build \ - && git clone https://forge.etsi.org/rep/forge-tools/robot2doc.git \ - && cd robot2doc \ - && pip3 install -r requirements.txt \ - && python3 -m pip install -e . - -RUN DEBIAN_FRONTEND=noninteractive \ - && cd /home/etsi/dev/robot \ - && pip3 install -r requirements.txt - - -ADD . /home/etsi/dev/robot - -RUN chmod +x /home/etsi/dev/robot/scripts/* - -CMD tail -f /dev/null - - diff --git a/scripts/launch-validation.sh b/scripts/launch-validation.sh deleted file mode 100644 index 59030577655abb1e4a05e0e092b7b8af5cd105ba..0000000000000000000000000000000000000000 --- a/scripts/launch-validation.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -echo "Starting check on ROBOT CODE" - -for FILE in $(find . -name "*.robot"); do - echo "Syntax check on ${FILE}" - robot --dryrun -d /tmp ${FILE} -done diff --git a/scripts/run-all.bash b/scripts/run-all.bash deleted file mode 100644 index 793febd18ebca7b55f1eecc2fbaf294f19c3dee9..0000000000000000000000000000000000000000 --- a/scripts/run-all.bash +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -## Launch robot tests validator - -mkdir logs - -/bin/bash scripts/launch-validation.sh > logs/robot_stdout.log 2> logs/robot_stderr.log - -## Filter failed Keywords -grep -r10n "| FAIL |" logs/robot_stdout.log | grep -v "Output:" | grep -v "Log:" | grep -v "Report:" > logs/failures.log -rm -f logs/robot_stdout.log - - -## Filter Errors on code -grep -rn " ERROR " logs/robot_stderr.log | grep -v "File has no tests or tasks" > logs/errors.log -rm -f logs/robot_stderr.log - - -ERRORS=`awk 'END{print NR}' logs/errors.log logs/failures.log` -if [ "${ERRORS}" -eq 0 ]; then - rm -f logs/errors.log - rm -f logs/failures.log -fi - - -if [ -f logs/errors.log ]; then - cat logs/errors.log -fi - -if [ -f logs/failures.log ]; then - cat logs/failures.log -fi - -if [ -f logs/erros.log ] || [ -f logs.failures.log ]; then - echo "Errors are found. Job failed" - exit 1 -fi - diff --git a/scripts/run-container.sh b/scripts/run-container.sh deleted file mode 100644 index af5a8eb9b9d0cd629bb2492dcc9310be1e182046..0000000000000000000000000000000000000000 --- a/scripts/run-container.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright ETSI 2019 -# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt - -#set -e -#set -vx - -mkdir -p build - -echo "Using git branch $2" - -docker run -v "$(pwd)/build:/home/etsi/dev/build" stf583-rf-validation:latest "bash" \ - -c "/home/etsi/dev/robot/scripts/validate.sh $2" - -ret=$? - -exit $ret - diff --git a/scripts/validate.sh b/scripts/validate.sh deleted file mode 100644 index d6beb04478aa8cb3f6159d3c26741511a9508845..0000000000000000000000000000000000000000 --- a/scripts/validate.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# Validate syntax and keywords existance in each Robot file - -cd /home/etsi/dev/robot/ - -res=0 -for i in */*/*.robot ; do - if [[ "$i" != *"Keywords.robot"* && "$i" != *"Keyword.robot"* ]] ; then - echo "++++ Dryrun file $i" - msg=$(robot --dryrun --output NONE --report NONE --log NONE $i 2>&1) - if [ $? != 0 ] ; then - echo "++++ Issues found in file $i" - echo "$msg" - res=1 - fi - fi -done - -echo "Using git branch $1" - -mkdir -p /home/etsi/dev/build -cd /home/etsi/dev/build -rm -r -v * - -if [[ $1 =~ ^(origin\/){0,1}([0-9]{1}(\.[0-9]){2}){1}-dev$ || $1 =~ ^(origin\/){0,1}([0-9]{1})(\.[0-9]){2,10}$ || $1 =~ ^(origin\/){0,1}master$ || $1 =~ ^(origin\/){0,1}Release-([0-9]{1})$ ]]; then - - echo "++++ Try to generate docs for branch $1" - cd /home/etsi/dev/robot2doc/robot2doc - - python3 create_sols.py ../../robot 'local' ../../build - res2=$? -else res2=0 - echo "++++ Not generating docs for branch $1" -fi - -exit $res && $res2