<commit_before>#!/bin/bash
#printf "\n\n======== POST SON Package to Catalogue ========\n\n\n"
#resp=$(curl -qSfsw '\n%{http_code}' -H 'content-disposition: attachment; filename=sonata_example.son' \
#  -H 'content-type: application/zip' \
#  -F "package=@resources/sonata-demo.son" -X POST http://sp.int3.sonata-nfv.eu:4002/catalogues/son-packages)
#echo $resp

#package=$(echo $resp | grep "uuid")
#echo "UUID: $package"

#code=$(echo "$resp" | tail -n1)
#echo "Code: $code"

printf "\n\n======== GET Package UUID from Gatekeeper  ========\n\n\n"
resp=$(curl -qSfsw '\n%{http_code}' -H "Content-Type: application/json" -X GET http://sp.int3.sonata-nfv.eu:32001/api/v2/packages) 2>/dev/null
echo $resp

package=$(echo "$resp" | head -n-1)
uuid=$(echo $package  |  python -mjson.tool | grep "uuid" | awk -F'[=:]' '{print $2}' | sed 's/\"//g' | tr -d ',' | tr -d '[:space:]')
echo "UUID: $uuid"

printf "\n\n======== GET SON Package from Gatekeeper ========\n\n\n"
#url=$(echo http://sp.int3.sonata-nfv.eu:32001/packages/${uuid})
#echo "URL: $url"
resp=$(curl -qSfsw '\n%{http_code}' -X GET http://sp.int3.sonata-nfv.eu:32001/api/v2/packages/${uuid}) 2>/dev/null
echo $resp

code=$(echo "$resp" | tail -n1)
echo "Code: $code"

if [[ $code != 200 ]] ;
  then
    echo "Error: Response error $code"
    exit -1
fi

printf "\n\n======== GET SON Package UUID from Catalogue  ========\n\n\n"
resp=$(curl -qSfsw '\n%{http_code}' -H "Content-Type: application/json" -X GET http://sp.int3.sonata-nfv.eu:4002/catalogues/son-packages) 2>/dev/null
echo $resp

package=$(echo "$resp" | head -n-1)
uuid=$(echo $package  |  python -mjson.tool | grep "uuid" | awk -F'[=:]' '{print $2}' | sed 's/\"//g' | tr -d ',' | tr -d '[:space:]')
echo "UUID: $uuid"

#printf "\n\n======== GET SON Package from Catalogue ========\n\n\n"
#url=$(echo http://sp.int3.sonata-nfv.eu:32001/packages/${uuid})
#url=$(echo http://sp.int3.sonata-nfv.eu:4002/catalogues/son-packages/${uuid})
#echo "URL: $url"
#resp=$(curl -qSfsw '\n%{http_code}' -X GET http://sp.int3.sonata-nfv.eu:32001/packages/${uuid}) 2>/dev/null
#resp=$(curl -qSfsw '\n%{http_code}' -X GET http://sp.int3.sonata-nfv.eu:4002/catalogues/son-packages/${uuid}) 2>/dev/null
#echo $resp

#code=$(echo "$resp" | tail -n1)
#echo "Code: $code"

#if [[ $code != 200 ]] ;
#  then
#    echo "Error: Response error $code"
#    exit -1
#fi
<commit_msg>Fixed bug for son-packages test. Added new test for Catalogues<commit_after>#!/bin/bash
#printf "\n\n======== POST SON Package to Catalogue ========\n\n\n"
#resp=$(curl -qSfsw '\n%{http_code}' -H 'content-disposition: attachment; filename=sonata_example.son' \
#  -H 'content-type: application/zip' \
#  -F "package=@resources/sonata-demo.son" -X POST http://sp.int3.sonata-nfv.eu:4002/catalogues/son-packages)
#echo $resp

#package=$(echo $resp | grep "uuid")
#echo "UUID: $package"

#code=$(echo "$resp" | tail -n1)
#echo "Code: $code"

printf "\n\n======== GET Package UUID and SON_PACKAGE_UUID from Gatekeeper  ========\n\n\n"
resp=$(curl -qSfsw '\n%{http_code}' -H "Content-Type: application/json" -X GET http://sp.int3.sonata-nfv.eu:32001/api/v2/packages) 2>/dev/null
echo $resp

package=$(echo "$resp" | head -n-1)
son_package_uuid=$(echo $package  |  python -mjson.tool | grep -w "son_package_uuid" | awk -F'[=:]' '{print $2}' | sed 's/\"//g' | tr -d ',' | tr -d '[:space:]')
uuid=$(echo $package  |  python -mjson.tool | grep -w "uuid" | awk -F'[=:]' '{print $2}' | sed 's/\"//g' | tr -d ',' | tr -d '[:space:]')
echo "SON_PACKAGE_UUID: $son_package_uuid"
echo "UUID: $uuid"

#foo=${uuid#$son_package_uuid}
#echo "FOO!: $foo"



printf "\n\n======== GET Package from Gatekeeper ========\n\n\n"
#url=$(echo http://sp.int3.sonata-nfv.eu:32001/packages/${uuid})
#echo "URL: $url"
resp=$(curl -qSfsw '\n%{http_code}' -H "Content-Type: application/json" -X GET http://sp.int3.sonata-nfv.eu:32001/api/v2/packages/${uuid}) 2>/dev/null
echo $resp

code=$(echo "$resp" | tail -n1)
echo "Code: $code"

if [[ $code != 200 ]] ;
  then
    echo "Error: Response error $code"
    exit -1
fi

printf "\n\n======== GET SON Package from Gatekeeper ========\n\n\n"
#url=$(echo http://sp.int3.sonata-nfv.eu:32001/packages/${uuid})
#echo "URL: $url"
echo "Not implemented yet"
#resp=$(curl -qSfsw '\n%{http_code}' -H "Content-Type: application/json" -X GET http://sp.int3.sonata-nfv.eu:32001/api/v2/son-packages/${son_package_uuid}/) 2>/dev/null
#echo $resp

#code=$(echo "$resp" | tail -n1)
#echo "Code: $code"

#if [[ $code != 200 ]] ;
#  then
#    echo "Error: Response error $code"
#    exit -1
#fi

printf "\n\n======== GET SON Package UUID from Catalogue  ========\n\n\n"
resp=$(curl -qSfsw '\n%{http_code}' -H "Content-Type: application/json" -X GET http://sp.int3.sonata-nfv.eu:4002/catalogues/son-packages) 2>/dev/null
echo $resp

package=$(echo "$resp" | head -n-1)
son_package_uuid=$(echo $package  |  python -mjson.tool | grep -w "uuid" | awk -F'[=:]' '{print $2}' | sed 's/\"//g' | tr -d ',' | tr -d '[:space:]')
echo "SON_PACKAGE_UUID: $son_package_uuid"

printf "\n\n======== GET SON Package from Catalogue ========\n\n\n"
#echo "Not implemented yet"
#url=$(echo http://sp.int3.sonata-nfv.eu:4002/catalogues/son-packages/${uuid})
#echo "URL: $url"
resp=$(curl -qSfsw '\n%{http_code}' -X GET http://sp.int3.sonata-nfv.eu:4002/catalogues/son-packages/${son_package_uuid}) 2>/dev/null
echo $resp

code=$(echo "$resp" | tail -n1)
echo "Code: $code"

if [[ $code != 200 ]] ;
  then
    echo "Error: Response error $code"
    exit -1
fi

{'fraction_non_alphanumeric': 0.2460951689066473, 'fraction_numerical': 0.02742462767889575, 'mean_word_length': 4.047662694775435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4111264', 'n_tokens_mistral': 2330, 'n_tokens_neox': 2228, 'n_words': 523}