Skip to content

Commit cd7003a

Browse files
committed
New HTTP tests for relative URIs in PUT request body
SNAPSHOT bump Server & Web-Client SNAPSHOT bumps
1 parent e17fddb commit cd7003a

3 files changed

Lines changed: 82 additions & 4 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
initialize_dataset "$END_USER_BASE_URL" "$TMP_END_USER_DATASET" "$END_USER_ENDPOINT_URL"
5+
initialize_dataset "$ADMIN_BASE_URL" "$TMP_ADMIN_DATASET" "$ADMIN_ENDPOINT_URL"
6+
purge_cache "$END_USER_VARNISH_SERVICE"
7+
purge_cache "$ADMIN_VARNISH_SERVICE"
8+
purge_cache "$FRONTEND_VARNISH_SERVICE"
9+
10+
# add agent to the writers group
11+
12+
add-agent-to-group.sh \
13+
-f "$OWNER_CERT_FILE" \
14+
-p "$OWNER_CERT_PWD" \
15+
--agent "$AGENT_URI" \
16+
"${ADMIN_BASE_URL}acl/groups/writers/"
17+
18+
# creating new document fails because relative URIs are not allowed in N-Triples
19+
20+
item="${END_USER_BASE_URL}new-item/"
21+
22+
(
23+
curl -k -w "%{http_code}\n" -o /dev/null -s \
24+
-E "$AGENT_CERT_FILE":"$AGENT_CERT_PWD" \
25+
-X PUT \
26+
-H "Accept: application/n-triples" \
27+
-H "Content-Type: application/n-triples" \
28+
--data-binary @- \
29+
"$item" <<EOF
30+
<named-subject-put> <http://example.com/default-predicate> "named object PUT" .
31+
<named-subject-put> <http://example.com/another-predicate> "another named object PUT" .
32+
EOF
33+
) \
34+
| grep -q "$STATUS_BAD_REQUEST"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
initialize_dataset "$END_USER_BASE_URL" "$TMP_END_USER_DATASET" "$END_USER_ENDPOINT_URL"
5+
initialize_dataset "$ADMIN_BASE_URL" "$TMP_ADMIN_DATASET" "$ADMIN_ENDPOINT_URL"
6+
purge_cache "$END_USER_VARNISH_SERVICE"
7+
purge_cache "$ADMIN_VARNISH_SERVICE"
8+
purge_cache "$FRONTEND_VARNISH_SERVICE"
9+
10+
# add agent to the writers group
11+
12+
add-agent-to-group.sh \
13+
-f "$OWNER_CERT_FILE" \
14+
-p "$OWNER_CERT_PWD" \
15+
--agent "$AGENT_URI" \
16+
"${ADMIN_BASE_URL}acl/groups/writers/"
17+
18+
# create new document - relative URIs allowed in Turtle and should resolve against the document URI as base
19+
20+
item="${END_USER_BASE_URL}new-item/"
21+
22+
(
23+
curl -k -w "%{http_code}\n" -o /dev/null -f -s \
24+
-E "$AGENT_CERT_FILE":"$AGENT_CERT_PWD" \
25+
-X PUT \
26+
-H "Accept: application/n-triples" \
27+
-H "Content-Type: text/turtle" \
28+
--data-binary @- \
29+
"$item" <<EOF
30+
<named-subject-put> <http://example.com/default-predicate> "named object PUT" .
31+
<named-subject-put> <http://example.com/another-predicate> "another named object PUT" .
32+
EOF
33+
) \
34+
| grep -q "$STATUS_CREATED"
35+
36+
# check that resource is accessible
37+
38+
curl -k -f -G -s \
39+
-E "$AGENT_CERT_FILE":"$AGENT_CERT_PWD" \
40+
-H "Accept: application/n-triples" \
41+
"$item" \
42+
| tr -d '\n' \
43+
| grep "<${item}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/ns/ldt/document-hierarchy#Item>" \
44+
| grep -q "<${item}named-subject-put> <http://example.com/default-predicate> \"named object PUT\" ."

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.atomgraph</groupId>
55
<artifactId>linkeddatahub</artifactId>
6-
<version>5.0.11-SNAPSHOT</version>
6+
<version>5.0.12-SNAPSHOT</version>
77
<packaging>${packaging.type}</packaging>
88

99
<name>AtomGraph LinkedDataHub</name>
@@ -135,18 +135,18 @@
135135
<dependency>
136136
<groupId>${project.groupId}</groupId>
137137
<artifactId>server</artifactId>
138-
<version>4.1.11-SNAPSHOT</version>
138+
<version>4.1.12-SNAPSHOT</version>
139139
</dependency>
140140
<dependency>
141141
<groupId>${project.groupId}</groupId>
142142
<artifactId>client</artifactId>
143-
<version>4.2.1-SNAPSHOT</version>
143+
<version>4.2.2-SNAPSHOT</version>
144144
<classifier>classes</classifier>
145145
</dependency>
146146
<dependency>
147147
<groupId>${project.groupId}</groupId>
148148
<artifactId>client</artifactId>
149-
<version>4.2.1-SNAPSHOT</version>
149+
<version>4.2.2-SNAPSHOT</version>
150150
<type>war</type>
151151
</dependency>
152152
<!-- required by jsonld-java - version same as Jersey's HTTP Client -->

0 commit comments

Comments
 (0)