Skip to content

Commit

Permalink
Scripts moved to bin and added to PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
namedgraph committed Feb 7, 2025
1 parent 21d18dc commit 3d27ff8
Show file tree
Hide file tree
Showing 109 changed files with 161 additions and 611 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/http-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ jobs:
- name: Unpack Jena
run: tar -zxf jena.tar.gz
working-directory: ${{ runner.temp }}
- name: Set JENA_HOME and Update PATH
- name: Set JENA_HOME and update PATH
run: |
echo "${{ runner.temp }}/apache-jena-${{ env.JENA_VERSION }}/bin" >> $GITHUB_PATH
- name: Checkout code
uses: actions/checkout@v3
- name: Add all subdirectories in bin/ to PATH
run: |
for d in "bin"/*/; do
echo "$d" >> "$GITHUB_PATH"
done
- name: Generating server certificate
run: ../scripts/server-cert-gen.sh .env nginx ssl
working-directory: http-tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ if [ -n "$description" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | ./post.sh "${args[@]}"
echo -e "$turtle" | post.sh "${args[@]}"
4 changes: 2 additions & 2 deletions scripts/add-object-block.sh → bin/add-object-block.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fi

target="$1"

ntriples=$(./get.sh \
ntriples=$(get.sh \
-f "$cert_pem_file" \
-p "$cert_password" \
--proxy "$proxy" \
Expand Down Expand Up @@ -143,4 +143,4 @@ if [ -n "$mode" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | ./post.sh "${args[@]}"
echo -e "$turtle" | post.sh "${args[@]}"
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ if [ -n "$description" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | ./post.sh "${args[@]}"
echo -e "$turtle" | post.sh "${args[@]}"
2 changes: 1 addition & 1 deletion scripts/add-select.sh → bin/add-select.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ if [ -n "$description" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | ./post.sh "${args[@]}"
echo -e "$turtle" | post.sh "${args[@]}"
2 changes: 1 addition & 1 deletion scripts/add-view.sh → bin/add-view.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ if [ -n "$mode" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | ./post.sh "${args[@]}"
echo -e "$turtle" | post.sh "${args[@]}"
4 changes: 2 additions & 2 deletions scripts/add-xhtml-block.sh → bin/add-xhtml-block.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fi

target="$1"

ntriples=$(./get.sh \
ntriples=$(get.sh \
-f "$cert_pem_file" \
-p "$cert_password" \
--proxy "$proxy" \
Expand Down Expand Up @@ -133,4 +133,4 @@ if [ -n "$description" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | ./post.sh "${args[@]}"
echo -e "$turtle" | post.sh "${args[@]}"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,4 @@ if [ -n "$write" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../../put.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | put.sh "${args[@]}"
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ do
done

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../../put.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | put.sh "${args[@]}"
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ do
done

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../../post.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | post.sh "${args[@]}"
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ if [ -n "$comment" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../../post.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | post.sh "${args[@]}"
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ if [ -n "$comment" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../../post.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | post.sh "${args[@]}"
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ if [ -n "$has_value" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../../post.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | post.sh "${args[@]}"
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ if [ -n "$service" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../../post.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | post.sh "${args[@]}"
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ if [ -n "$comment" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../../put.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | put.sh "${args[@]}"
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/create-container.sh → bin/create-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ if [ -n "$description" ] ; then
turtle+="<${target}> dct:description \"${description}\" .\n"
fi

echo -e "$turtle" | turtle --base="$base" | ./put.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | put.sh "${args[@]}"
2 changes: 1 addition & 1 deletion scripts/create-item.sh → bin/create-item.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ if [ -n "$description" ] ; then
turtle+="<${target}> dct:description \"${description}\" .\n"
fi

echo -e "$turtle" | turtle --base="$base" | ./put.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | put.sh "${args[@]}"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ if [ -n "$description" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../put.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | put.sh "${args[@]}"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ if [ -n "$description" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../put.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | .put.sh "${args[@]}"
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ if [ -n "$description" ] ; then
fi

# submit Turtle doc to the server
echo -e "$turtle" | turtle --base="$base" | ../put.sh "${args[@]}"
echo -e "$turtle" | turtle --base="$base" | put.sh "${args[@]}"
21 changes: 7 additions & 14 deletions scripts/imports/import-csv.sh → bin/imports/import-csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ if [ -z "$proxy" ] ; then
proxy="$base"
fi

query_doc=$(./create-query.sh \
query_doc=$(create-query.sh \
-b "$base" \
-f "$cert_pem_file" \
-p "$cert_password" \
Expand All @@ -149,21 +149,17 @@ query_doc=$(./create-query.sh \
--query-file "$query_file"
)

pushd . > /dev/null && cd "$SCRIPT_ROOT"

query_ntriples=$(./get.sh \
query_ntriples=$(get.sh \
-f "$cert_pem_file" \
-p "$cert_password" \
--proxy "$proxy" \
--accept 'application/n-triples' \
"$query_doc"
)

popd > /dev/null

query=$(echo "$query_ntriples" | sed -rn "s/<${query_doc//\//\\/}> <http:\/\/xmlns.com\/foaf\/0.1\/primaryTopic> <(.*)> \./\1/p" | head -1)

file_doc=$(./create-file.sh \
file_doc=$(create-file.sh \
-b "$base" \
-f "$cert_pem_file" \
-p "$cert_password" \
Expand All @@ -175,20 +171,16 @@ file_doc=$(./create-file.sh \
--file-content-type "text/csv"
)

pushd . > /dev/null && cd "$SCRIPT_ROOT"

file_ntriples=$(./get.sh \
file_ntriples=$(get.sh \
-f "$cert_pem_file" \
-p "$cert_password" \
--proxy "$proxy" \
--accept 'application/n-triples' \
"$file_doc")

popd > /dev/null

file=$(echo "$file_ntriples" | sed -rn "s/<${file_doc//\//\\/}> <http:\/\/xmlns.com\/foaf\/0.1\/primaryTopic> <(.*)> \./\1/p" | head -1)

./create-csv-import.sh \
create-csv-import.sh \
-b "$base" \
-f "$cert_pem_file" \
-p "$cert_password" \
Expand All @@ -197,4 +189,5 @@ file=$(echo "$file_ntriples" | sed -rn "s/<${file_doc//\//\\/}> <http:\/\/xmlns.
--slug "$import_slug" \
--query "$query" \
--file "$file" \
--delimiter "$delimiter"
--delimiter "$delimiter"

20 changes: 6 additions & 14 deletions scripts/imports/import-rdf.sh → bin/imports/import-rdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ if [ -z "$proxy" ] ; then
fi

if [ -n "$query_file" ] ; then
query_doc=$(./create-query.sh \
query_doc=$(create-query.sh \
-b "$base" \
-f "$cert_pem_file" \
-p "$cert_password" \
Expand All @@ -153,22 +153,18 @@ if [ -n "$query_file" ] ; then
--query-file "$query_file"
)

pushd . > /dev/null && cd "$SCRIPT_ROOT"

query_ntriples=$(./get.sh \
query_ntriples=$(get.sh \
-f "$cert_pem_file" \
-p "$cert_password" \
--proxy "$proxy" \
--accept 'application/n-triples' \
"$query_doc"
)

popd > /dev/null

query=$(echo "$query_ntriples" | sed -rn "s/<${query_doc//\//\\/}> <http:\/\/xmlns.com\/foaf\/0.1\/primaryTopic> <(.*)> \./\1/p" | head -1)
fi

file_doc=$(./create-file.sh \
file_doc=$(create-file.sh \
-b "$base" \
-f "$cert_pem_file" \
-p "$cert_password" \
Expand All @@ -180,22 +176,18 @@ file_doc=$(./create-file.sh \
--file-content-type "$file_content_type"
)

pushd . > /dev/null && cd "$SCRIPT_ROOT"

file_ntriples=$(./get.sh \
file_ntriples=$(get.sh \
-f "$cert_pem_file" \
-p "$cert_password" \
--proxy "$proxy" \
--accept 'application/n-triples' \
"$file_doc"
)

popd > /dev/null

file=$(echo "$file_ntriples" | sed -rn "s/<${file_doc//\//\\/}> <http:\/\/xmlns.com\/foaf\/0.1\/primaryTopic> <(.*)> \./\1/p" | head -1)

if [ -n "$query" ] ; then
./create-rdf-import.sh \
create-rdf-import.sh \
-b "$base" \
-f "$cert_pem_file" \
-p "$cert_password" \
Expand All @@ -205,7 +197,7 @@ if [ -n "$query" ] ; then
--query "$query" \
--file "$file"
else
./create-rdf-import.sh \
create-rdf-import.sh \
-b "$base" \
-f "$cert_pem_file" \
-p "$cert_password" \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 2 additions & 10 deletions http-tests/admin/acl/add-delete-authorization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,21 @@ curl -k -w "%{http_code}\n" -o /dev/null -s \
"$END_USER_BASE_URL" \
| grep -q "$STATUS_FORBIDDEN"

pushd . > /dev/null && cd "$SCRIPT_ROOT"

# create container

slug="test"

container=$(./create-container.sh \
container=$(create-container.sh \
-f "$OWNER_CERT_FILE" \
-p "$OWNER_CERT_PWD" \
-b "$END_USER_BASE_URL" \
--title "Test" \
--slug "$slug" \
--parent "$END_USER_BASE_URL")

popd > /dev/null

pushd . > /dev/null && cd "$SCRIPT_ROOT/admin/acl"

# create authorization

./create-authorization.sh \
create-authorization.sh \
-f "$OWNER_CERT_FILE" \
-p "$OWNER_CERT_PWD" \
-b "$ADMIN_BASE_URL" \
Expand All @@ -45,8 +39,6 @@ pushd . > /dev/null && cd "$SCRIPT_ROOT/admin/acl"
--to "$container" \
--write

popd > /dev/null

# access is allowed after authorization is created

curl -k -w "%{http_code}\n" -o /dev/null -f -s \
Expand Down
12 changes: 2 additions & 10 deletions http-tests/admin/acl/add-delete-class-authorization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,21 @@ curl -k -w "%{http_code}\n" -o /dev/null -s \
"$END_USER_BASE_URL" \
| grep -q "$STATUS_FORBIDDEN"

pushd . > /dev/null && cd "$SCRIPT_ROOT"

# create container

slug="test"

container=$(./create-container.sh \
container=$(create-container.sh \
-f "$OWNER_CERT_FILE" \
-p "$OWNER_CERT_PWD" \
-b "$END_USER_BASE_URL" \
--title "Test" \
--slug "$slug" \
--parent "$END_USER_BASE_URL")

popd > /dev/null

pushd . > /dev/null && cd "$SCRIPT_ROOT/admin/acl"

# create authorization

./create-authorization.sh \
create-authorization.sh \
-f "$OWNER_CERT_FILE" \
-p "$OWNER_CERT_PWD" \
-b "$ADMIN_BASE_URL" \
Expand All @@ -45,8 +39,6 @@ pushd . > /dev/null && cd "$SCRIPT_ROOT/admin/acl"
--to-all-in "https://www.w3.org/ns/ldt/document-hierarchy#Container" \
--write

popd > /dev/null

# access is allowed after authorization is created

curl -k -w "%{http_code}\n" -o /dev/null -f -s \
Expand Down
Loading

0 comments on commit 3d27ff8

Please sign in to comment.