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 31dc004 Demonstrate Karate's schema-like matching
31dc004 is described below
commit 31dc0043c509e01a3aa6b45083d13097d84c177d
Author: Bertrand Delacretaz <[email protected]>
AuthorDate: Wed Sep 5 11:08:18 2018 +0200
Demonstrate Karate's schema-like matching
---
.../src/test/java/sling/filestorage/uploadImage.feature | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git
a/karate-http-testing/src/test/java/sling/filestorage/uploadImage.feature
b/karate-http-testing/src/test/java/sling/filestorage/uploadImage.feature
index c9f74da..8125abb 100644
--- a/karate-http-testing/src/test/java/sling/filestorage/uploadImage.feature
+++ b/karate-http-testing/src/test/java/sling/filestorage/uploadImage.feature
@@ -33,14 +33,26 @@ Then status 201
# The Location header provides the path where the resource was created
* def imagePath = responseHeaders['Location'][0]
+# Use Karate's schema-like features for the file element
+* def expectedFile =
+"""
+{
+ "jcr:primaryType" : "nt:resource",
+ "jcr:mimeType" : "application/octet-stream",
+ "jcr:lastModifiedBy" : #string,
+ "jcr:lastModified" : #string,
+ ":jcr:data" : "10102",
+ "jcr:uuid" : #uuid
+}
+"""
+
# Read metadata back and verify
Given path imagePath + '.tidy.5.json'
When method GET
Then status 200
And match response.jcr:primaryType == 'nt:unstructured'
And match response.name == filename
-And match response.file.jcr:primaryType == 'nt:resource'
-And match response.file.jcr:mimeType == 'application/octet-stream'
+And match response.file == expectedFile
# Read the image itself back and verify
Given path imagePath + '/file/jcr:data'