You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2021/11/15 11:13:41 UTC
[sling-whiteboard] branch master updated: Test content storage
This is an automated email from the ASF dual-hosted git repository.
bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new ae78514 Test content storage
ae78514 is described below
commit ae785146870b68fe1925ff1b7f1793c322a3b1f6
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Nov 15 12:12:10 2021 +0100
Test content storage
---
.../karate/content/invalid-minimal-content.json | 5 ++++
.../jsonstore/karate/content/minimal-content.json | 4 +++
...eContent.feature => createSlingContent.feature} | 0
...{schemaStorage.feature => storeContent.feature} | 29 ++++++++++++++--------
.../{schemaStorage.feature => storeSchema.feature} | 0
5 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/json-store/src/test/java/org/apache/sling/jsonstore/karate/content/invalid-minimal-content.json b/json-store/src/test/java/org/apache/sling/jsonstore/karate/content/invalid-minimal-content.json
new file mode 100644
index 0000000..26679d1
--- /dev/null
+++ b/json-store/src/test/java/org/apache/sling/jsonstore/karate/content/invalid-minimal-content.json
@@ -0,0 +1,5 @@
+{
+ "$schema":"test/minimal",
+ "extra":"property that's not in the schema",
+ "tags": [ "home", "green" ]
+}
\ No newline at end of file
diff --git a/json-store/src/test/java/org/apache/sling/jsonstore/karate/content/minimal-content.json b/json-store/src/test/java/org/apache/sling/jsonstore/karate/content/minimal-content.json
new file mode 100644
index 0000000..74e7038
--- /dev/null
+++ b/json-store/src/test/java/org/apache/sling/jsonstore/karate/content/minimal-content.json
@@ -0,0 +1,4 @@
+{
+ "$schema":"test/minimal",
+ "tags": [ "home", "green" ]
+}
\ No newline at end of file
diff --git a/json-store/src/test/java/org/apache/sling/jsonstore/karate/createContent.feature b/json-store/src/test/java/org/apache/sling/jsonstore/karate/createSlingContent.feature
similarity index 100%
rename from json-store/src/test/java/org/apache/sling/jsonstore/karate/createContent.feature
rename to json-store/src/test/java/org/apache/sling/jsonstore/karate/createSlingContent.feature
diff --git a/json-store/src/test/java/org/apache/sling/jsonstore/karate/schemaStorage.feature b/json-store/src/test/java/org/apache/sling/jsonstore/karate/storeContent.feature
similarity index 73%
copy from json-store/src/test/java/org/apache/sling/jsonstore/karate/schemaStorage.feature
copy to json-store/src/test/java/org/apache/sling/jsonstore/karate/storeContent.feature
index 9a054d8..7e1dcef 100644
--- a/json-store/src/test/java/org/apache/sling/jsonstore/karate/schemaStorage.feature
+++ b/json-store/src/test/java/org/apache/sling/jsonstore/karate/storeContent.feature
@@ -18,8 +18,8 @@
# */
# ------------------------------------------------------------------------
-@schema
-Feature: Test schema storage
+@content
+Feature: Test content storage
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
@@ -42,25 +42,34 @@ When method DELETE
* match [204,404,405] contains responseStatus
# ------------------------------------------------------------------------
-Scenario: Store a valid schema
+Scenario: Store minimal schema
# ------------------------------------------------------------------------
Given request read('/schema/minimal.json')
-And path 'content/sites/example.com/schema/minimal'
+And path 'content/sites/example.com/schema/test/minimal'
When method POST
Then status 200
# ------------------------------------------------------------------------
-Scenario: Retrieve and check the valid schema
+Scenario: Store content
# ------------------------------------------------------------------------
-Given path 'content/sites/example.com/schema/minimal'
+Given request read('/content/minimal-content.json')
+And path 'content/sites/example.com/content/somepath/minimal'
+When method POST
+Then status 200
+
+# ------------------------------------------------------------------------
+Scenario: Verify content
+# ------------------------------------------------------------------------
+Given path 'content/sites/example.com/content/somepath/minimal'
When method GET
Then status 200
-And match response == read('/schema/minimal.json')
+And match response == read('/content/minimal-content.json')
# ------------------------------------------------------------------------
-Scenario: Error trying to store an invalid schema
+Scenario: Invalid content
# ------------------------------------------------------------------------
-Given request read('/schema/invalid.json')
-And path 'content/sites/example.com/schema/invalid'
+Given request read('/content/invalid-minimal-content.json')
+And path 'content/sites/example.com/content/somepath/willfail'
When method POST
Then status 400
+* match response contains "DataTypeValidator$ValidatorException"
\ No newline at end of file
diff --git a/json-store/src/test/java/org/apache/sling/jsonstore/karate/schemaStorage.feature b/json-store/src/test/java/org/apache/sling/jsonstore/karate/storeSchema.feature
similarity index 100%
rename from json-store/src/test/java/org/apache/sling/jsonstore/karate/schemaStorage.feature
rename to json-store/src/test/java/org/apache/sling/jsonstore/karate/storeSchema.feature