Client API Test suite (TCK)

Updated: March 18, 2024

This page is a work in progress.

This chapter provides a test suite that can be used to test the implementation of an automation client library.

Automation Client Test Suite

The test suite is separated in three sub-parts:

  • Basic CRUD operations on documents,
  • Blobs management,
  • Marshaling extensions.

Only the first part is strictly necessary.

Base CRUD

Create and Read Documents

Scenario
  1. Create a Folder on / (Document.Create).
  2. Create a File child (Document.Create).
  3. Create a File child (Document.Create).
  4. Update  dc:description  property on second child (Document.SetProperty).
  5. Update  dc:subjects  property on second child (Document.SetProperty).
  6. Get Children of Folder (Document.GetChildren).
  7. Specify that dublincore schema should be fetched.
  8. Verify that:

Java Implementation

GitHub Link for CRUD operations tests suite

JavaScript Implementation

Link JS

HTTP Captures

HTTP Signature - Document.Create

POST /nuxeo/site/automation/Document.Create HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 130
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Origin: http://127.0.0.1:8080
Content-Type: application/json+nxrequest
Accept: */*
X-NXDocumentProperties: dublincore
X-Requested-With: XMLHttpRequest
X-NXVoidOperation: false
Nuxeo-Transaction-Timeout: 35
{ "input" : "doc:/",
  "params" : { "name" : "TestDocs",
      "properties" : "dc:title=Test Docs \ndc:description=Simple container",
      "type" : "Folder"
    }
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
{ "changeToken" : "1372718688038",
  "contextParameters" : {  },
  "entity-type" : "document",
  "facets" : [ "Folderish" ],
  "lastModified" : "2013-07-01T22:44:48.03Z",
  "path" : "/TestDocs",
  "properties" : { "dc:contributors" : [ "Administrator" ],
      "dc:coverage" : null,
      "dc:created" : "2013-07-01T22:44:48.03Z",
      "dc:creator" : "Administrator",
      "dc:description" : "Simple container",
      "dc:expired" : null,
      "dc:format" : null,
      "dc:issued" : null,
      "dc:language" : null,
      "dc:lastContributor" : "Administrator",
      "dc:modified" : "2013-07-01T22:44:48.03Z",
      "dc:nature" : null,
      "dc:publisher" : null,
      "dc:rights" : null,
      "dc:source" : null,
      "dc:subjects" : [  ],
      "dc:title" : "Test Docs",
      "dc:valid" : null
    },
  "repository" : "default",
  "state" : "project",
  "title" : "Test Docs",
  "type" : "Folder",
  "uid" : "e27bc86b-d5f1-4ba9-a8e4-3ce96340f301",
  "versionLabel" : ""
}

POST /nuxeo/site/automation/Document.Create HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 69
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Origin: http://127.0.0.1:8080
Content-Type: application/json+nxrequest
Accept: */*
X-NXDocumentProperties: dublincore
X-Requested-With: XMLHttpRequest
X-NXVoidOperation: false
Nuxeo-Transaction-Timeout: 35
{ "input" : "doc:/TestDocs",
  "params" : { "name" : "TestFile1",
      "type" : "File"
    }
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
{ "changeToken" : "1372718688058",
  "contextParameters" : {  },
  "entity-type" : "document",
  "facets" : [ "Downloadable",
      "Commentable",
      "Versionable",
      "Publishable",
      "Thumbnail",
      "HasRelatedText"
    ],
  "lastModified" : "2013-07-01T22:44:48.05Z",
  "path" : "/TestDocs/TestFile1",
  "properties" : { "dc:contributors" : [ "Administrator" ],
      "dc:coverage" : null,
      "dc:created" : "2013-07-01T22:44:48.05Z",
      "dc:creator" : "Administrator",
      "dc:description" : null,
      "dc:expired" : null,
      "dc:format" : null,
      "dc:issued" : null,
      "dc:language" : null,
      "dc:lastContributor" : "Administrator",
      "dc:modified" : "2013-07-01T22:44:48.05Z",
      "dc:nature" : null,
      "dc:publisher" : null,
      "dc:rights" : null,
      "dc:source" : null,
      "dc:subjects" : [  ],
      "dc:title" : null,
      "dc:valid" : null
    },
  "repository" : "default",
  "state" : "project",
  "title" : "TestFile1",
  "type" : "File",
  "uid" : "29e654b3-02ae-4600-a057-d487fbac8fbd",
  "versionLabel" : "0.0"
}

POST /nuxeo/site/automation/Document.Create HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 69
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Origin: http://127.0.0.1:8080
Content-Type: application/json+nxrequest
Accept: */*
X-NXDocumentProperties: dublincore
X-Requested-With: XMLHttpRequest
X-NXVoidOperation: false
Nuxeo-Transaction-Timeout: 35
{ "input" : "doc:/TestDocs",
  "params" : { "name" : "TestFile2",
      "type" : "File"
    }
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
{ "changeToken" : "1372718688083",
  "contextParameters" : {  },
  "entity-type" : "document",
  "facets" : [ "Downloadable",
      "Commentable",
      "Versionable",
      "Publishable",
      "Thumbnail",
      "HasRelatedText"
    ],
  "lastModified" : "2013-07-01T22:44:48.08Z",
  "path" : "/TestDocs/TestFile2",
  "properties" : { "dc:contributors" : [ "Administrator" ],
      "dc:coverage" : null,
      "dc:created" : "2013-07-01T22:44:48.08Z",
      "dc:creator" : "Administrator",
      "dc:description" : null,
      "dc:expired" : null,
      "dc:format" : null,
      "dc:issued" : null,
      "dc:language" : null,
      "dc:lastContributor" : "Administrator",
      "dc:modified" : "2013-07-01T22:44:48.08Z",
      "dc:nature" : null,
      "dc:publisher" : null,
      "dc:rights" : null,
      "dc:source" : null,
      "dc:subjects" : [  ],
      "dc:title" : null,
      "dc:valid" : null
    },
  "repository" : "default",
  "state" : "project",
  "title" : "TestFile2",
  "type" : "File",
  "uid" : "7493912e-5d59-4041-9efc-a907c1d1fa07",
  "versionLabel" : "0.0"
}

HTTP Signature - Document.Update

POST /nuxeo/site/automation/Document.Update HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 133
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Origin: http://127.0.0.1:8080
Content-Type: application/json+nxrequest
Accept: */*
X-NXDocumentProperties: dublincore
X-Requested-With: XMLHttpRequest
X-NXVoidOperation: false
Nuxeo-Transaction-Timeout: 35
{ "input" : "doc:/TestDocs/TestFile2",
  "params" : { "properties" : "dc:description=Simple File\ndc:subjects=subject1,subject2",
      "save" : "true"
    }
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
{ "changeToken" : "1372718688104",
  "contextParameters" : {  },
  "entity-type" : "document",
  "facets" : [ "Downloadable",
      "Commentable",
      "Versionable",
      "Publishable",
      "Thumbnail",
      "HasRelatedText"
    ],
  "lastModified" : "2013-07-01T22:44:48.10Z",
  "path" : "/TestDocs/TestFile2",
  "properties" : { "dc:contributors" : [ "Administrator" ],
      "dc:coverage" : null,
      "dc:created" : "2013-07-01T22:44:48.08Z",
      "dc:creator" : "Administrator",
      "dc:description" : "Simple File",
      "dc:expired" : null,
      "dc:format" : null,
      "dc:issued" : null,
      "dc:language" : null,
      "dc:lastContributor" : "Administrator",
      "dc:modified" : "2013-07-01T22:44:48.10Z",
      "dc:nature" : null,
      "dc:publisher" : null,
      "dc:rights" : null,
      "dc:source" : null,
      "dc:subjects" : [ "subject1",
          "subject2"
        ],
      "dc:title" : null,
      "dc:valid" : null
    },
  "repository" : "default",
  "state" : "project",
  "title" : "TestFile2",
  "type" : "File",
  "uid" : "7493912e-5d59-4041-9efc-a907c1d1fa07",
  "versionLabel" : "0.0"
}

HTTP Signature - Document.Fetch

POST /nuxeo/site/automation/Document.Fetch HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Content-Type: application/json+nxrequest
Accept: application/json+nxentity, */*
Content-Length: 48
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.4 (java 1.5)

{"params":{"value":"/TestFolder1"},"context":{}}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
Transfer-Encoding: chunked
Date: Thu, 25 Jul 2013 14:20:03 GMT
{
  "entity-type": "document",
  "repository": "default",
  "uid": "6879c9c5-0fdf-4d53-85d0-32c8fa94a9e0",
  "path": "/TestFolder1",
  "type": "Folder",
  "state": "project",
  "versionLabel": "",
  "title": "Test Folder2",
  "lastModified": "2013-07-25T14:20:03.90Z",
  "facets": [
    "Folderish"
  ],
  "changeToken": "1374762003906",
  "contextParameters": {}
}

HTTP Signature - Document.GetChildren

POST /nuxeo/site/automation/Document.GetChildren HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Content-Type: application/json+nxrequest
Accept: application/json+nxentity, */*
Content-Length: 82
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.4 (java 1.5)

{
  "input": {
    "entity-type": "string",
    "value": "/TestFolder1"
  },
  "params": {},
  "context": {}
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
Transfer-Encoding: chunked
Date: Thu, 25 Jul 2013 14:20:03 GMT
{
  "entity-type": "documents",
  "entries": [
    {
      "entity-type": "document",
      "repository": "default",
      "uid": "dc499ced-e140-46e6-a5c4-58fbc19b589c",
      "path": "/TestFolder1/TestFile1",
      "type": "File",
      "state": "project",
      "versionLabel": "0.0",
      "title": "TestFile1",
      "lastModified": "2013-07-25T14:20:03.95Z",
      "facets": [
        "Downloadable",
        "Commentable",
        "Versionable",
        "Publishable",
        "Thumbnail",
        "HasRelatedText"
      ],
      "changeToken": "1374762003951",
      "contextParameters": {}
    },
    {
      "entity-type": "document",
      "repository": "default",
      "uid": "98181b11-ef91-48fa-b202-091f5d2ee809",
      "path": "/TestFolder1/TestFile2",
      "type": "File",
      "state": "project",
      "versionLabel": "0.0",
      "title": "TestFile2",
      "lastModified": "2013-07-25T14:20:04.04Z",
      "facets": [
        "Downloadable",
        "Commentable",
        "Versionable",
        "Publishable",
        "Thumbnail",
        "HasRelatedText"
      ],
      "changeToken": "1374762004043",
      "contextParameters": {}
    }
  ]
}

Pagination

Scenario
  1. Create a Folder on / (Document.Create).
  2. Create three Files children.
  3. Call Document.PageProvider with "select * from Document where  ecm:parentId  = ?" with

    • queryParams = Folder uuid
    • pageSize = 2
    • page = 1
  4. Verify:

    • pageCount=2
    • the page contains two docs.
  5. Call Document.PageProvider with "select * from Document where  ecm:parentId  = ?" with

    • queryParams = Folder uuid 
    • pageSize = 2
    • page = 2
  6. Verify:

    • pageCount=2
    • the page contains one document.
Java Implementation

GitHub Link for Pagination operations tests suite

HTTP Capture

HTTP Signature - Document.PageProvider

 POST /nuxeo/site/automation/Document.PageProvider HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Content-Type: application/json+nxrequest
Accept: application/json+nxentity, */*
Content-Length: 160
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.4 (java 1.5)

{
  "params": {
    "queryParams": "b583b0a7-cae4-4961-b94d-29c469ca8012",
    "page": "0",
    "query": "select * from Document where ecm:parentId = ?",
    "pageSize": "2"
  },
  "context": {}
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
Transfer-Encoding: chunked
Date: Thu, 25 Jul 2013 15:24:47 GMT
{
  "entity-type": "documents",
  "isPaginable": true,
  "totalSize": 3,
  "pageIndex": 0,
  "pageSize": 2,
  "pageCount": 2,
  "entries": [
    {
      "entity-type": "document",
      "repository": "default",
      "uid": "3f76a415-ad73-4522-9450-d12af25b7fb4",
      "path": "/TestFolder2/TestFile3",
      "type": "File",
      "state": "project",
      "versionLabel": "0.0",
      "title": "TestFile3",
      "lastModified": "2013-07-25T15:23:58.63Z",
      "facets": [
        "Downloadable",
        "Commentable",
        "Versionable",
        "Publishable",
        "Thumbnail",
        "HasRelatedText"
      ],
      "changeToken": "1374765838639",
      "contextParameters": {
        "documentURL": "/nuxeo/nxdoc/default/3f76a415-ad73-4522-9450-d12af25b7fb4/view_documents"
      }
    },
    {
      "entity-type": "document",
      "repository": "default",
      "uid": "1e751ded-c659-46da-8982-0963575f48f8",
      "path": "/TestFolder2/TestFile1",
      "type": "File",
      "state": "project",
      "versionLabel": "0.0",
      "title": "TestFile1",
      "lastModified": "2013-07-25T15:23:58.55Z",
      "facets": [
        "Downloadable",
        "Commentable",
        "Versionable",
        "Publishable",
        "Thumbnail",
        "HasRelatedText"
      ],
      "changeToken": "1374765838558",
      "contextParameters": {
        "documentURL": "/nuxeo/nxdoc/default/1e751ded-c659-46da-8982-0963575f48f8/view_documents"
      }
    }
  ]
}

Blobs

Direct Blob Upload

Scenario
  1. Create a Folder on / (Document.Create).
  2. Call FileManager.Import passing a testText.txt file and setting context to Folder.
  3. Call FileManager.Import passing a testBlob.bin binary file and setting context to Folder.
  4. Verify that:

    1. two documents are created, of types File and Note.
Java Implementation

GitHub link for Blob operations tests suite

HTTP Capture

HTTP Signature - FileManager.Import

POST /nuxeo/site/automation/FileManager.Import HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Content-Type: multipart/related;
    boundary="----=_Part_0_1227289322.1374766516160"
Accept: application/json+nxentity, */*
Transfer-Encoding: chunked
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.4 (java 1.5)
e7
------=_Part_0_1227289322.1374766516160
Content-Type: application/json+nxrequest; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: request
Content-Length: 57
{"params":{},"context":{"currentDocument":"/FolderBlob"}}
f5
------=_Part_0_1227289322.1374766516160
Content-Type: text/xml
Content-Transfer-Encoding: binary
Content-Disposition: attachment;
    filename=automation-test-5983650304333926591.xml
Content-ID: input
Content-Length: 16
<doc>mydoc</doc>
------=_Part_0_1227289322.1374766516160--

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
Transfer-Encoding: chunked
Date: Thu, 25 Jul 2013 15:35:16 GMT
{
  "entity-type": "document",
  "repository": "default",
  "uid": "77ec49fb-1832-4124-b8f6-270d53ac20bb",
  "path": "/FolderBlob/automation-test-59836503",
  "type": "File",
  "state": "project",
  "versionLabel": "0.0",
  "title": "automation-test-5983650304333926591.xml",
  "lastModified": "2013-07-25T15:35:16.24Z",
  "facets": [
    "Downloadable",
    "Commentable",
    "Versionable",
    "Publishable",
    "Thumbnail",
    "HasRelatedText"
  ],
  "changeToken": "1374766516241",
  "contextParameters": {}
}

HTTP Signature - Blob.Attach

POST /nuxeo/site/automation/Blob.Attach HTTP/1.1
X-NXVoidOperation: true
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Content-Type: multipart/related;
    boundary="----=_Part_1_2072469418.1374766516423"
Accept: application/json+nxentity, */*
Transfer-Encoding: chunked
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.4 (java 1.5)

------=_Part_1_2072469418.1374766516423
Content-Type: application/json+nxrequest; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: request
Content-Length: 46

{"params":{"document":"/myfile"},"context":{}}

------=_Part_1_2072469418.1374766516423
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-Disposition: attachment; filename=creationFields.json
Content-ID: input
Content-Length: 1288
[
    {
        "fieldType": "string",
        "description": "desc field0",
        "roles": [
            "Decision",
            "Score"
        ],
        "name": "field0",
        "columnName": "col0",
        "sqlTypeHint": "whatever"
    },
    {
        "fieldType": "string",
        "description": "desc field1",
        "roles": [
            "Decision",
            "Score"
        ],
        "name": "field1",
        "columnName": "col1",
        "sqlTypeHint": "whatever"
    },
    {
        "fieldType": "string",
        "description": "desc field2",
        "roles": [
            "Decision",
            "Score"
        ],
        "name": "field2",
        "columnName": "col2",
        "sqlTypeHint": "whatever"
    },
    {
        "fieldType": "string",
        "description": "desc field3",
        "roles": [
            "Decision",
            "Score"
        ],
        "name": "field3",
        "columnName": "col3",
        "sqlTypeHint": "whatever"
    },
    {
        "fieldType": "string",
        "description": "desc field4",
        "roles": [
            "Decision",
            "Score"
        ],
        "name": "field4",
        "columnName": "col4",
        "sqlTypeHint": "whatever"
    }
]
------=_Part_1_2072469418.1374766516423--

HTTP/1.1 204 No Content
Server: Apache-Coyote/1.1
Date: Thu, 25 Jul 2013 15:35:16 GMT

Blobs Upload via Batch Manager

Scenario
  1. Upload two blobs via batch manager:

    • testText.txt,
    • testBlob.bin.
  2. Call FileManager.Import via batch API:

    • set currentDocument to /
  3. Verify that:

    • two documents are created, of types File and Note.
Java Implementation

XXX Link the Java unit test

HTTP Capture

XXX Commented HTTP capture

Blobs Attach via Batch Manager

Scenario
  1. Create a File on / (Document.Create).
  2. Upload one blob via batch manager:

    1. testText.txt.
  3. Call Document.Update with two properties:

    • dc:description
    • file:content: reference Blob 1 from batch.
  4. Fetch the Document:

    • Specify to fetch the dublincore schema.
  5. Download the blob.
  6. Verify that:

    • Description was updated.
    • Blob exists and contains the expected text.
Java Implementation

XXX Link the Java unit test

HTTP Capture

XXX Commented Http capture

Marshaling Extensions

Manage Complex Properties

Scenario
  1. Create a File on / (Document.Create).
  2. Call Document.Update:

    1. dc:description,
    2. dc:subjects,
    3. some complex property.
  3. Fetch the Document:

    1. specify to fetch all schemas.
  4. Verify that:

    1. document content is ok (scalar, list and complex).
Java Implementation

GitHub link for Complex Properties operations tests suite

HTTP Capture

HTTP Signature - Complex Properties - Document.Create

POST /nuxeo/site/automation/Document.Create HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Content-Type: application/json+nxrequest
Accept: application/json+nxentity, */*
Content-Length: 1484
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.4 (java 1.5)

{
  "input": "doc:c3fbb3bd-8646-4b81-9380-63da531856e8",
  "params": {
    "name": "testDoc",
    "properties": "ds:fields=[    {        \"fieldType\": \"string\",        \"description\": \"desc field0\",        \"roles\": [            \"Decision\",            \"Score\"        ],        \"name\": \"field0\",        \"columnName\": \"col0\",        \"sqlTypeHint\": \"whatever\"    },    {        \"fieldType\": \"string\",        \"description\": \"desc field1\",        \"roles\": [            \"Decision\",            \"Score\"        ],        \"name\": \"field1\",        \"columnName\": \"col1\",        \"sqlTypeHint\": \"whatever\"    },    {        \"fieldType\": \"string\",        \"description\": \"desc field2\",        \"roles\": [            \"Decision\",            \"Score\"        ],        \"name\": \"field2\",        \"columnName\": \"col2\",        \"sqlTypeHint\": \"whatever\"    },    {        \"fieldType\": \"string\",        \"description\": \"desc field3\",        \"roles\": [            \"Decision\",            \"Score\"        ],        \"name\": \"field3\",        \"columnName\": \"col3\",        \"sqlTypeHint\": \"whatever\"    },    {        \"fieldType\": \"string\",        \"description\": \"desc field4\",        \"roles\": [            \"Decision\",            \"Score\"        ],        \"name\": \"field4\",        \"columnName\": \"col4\",        \"sqlTypeHint\": \"whatever\"    }]\nds:tableName=MyTable\ndc:title=testDoc\n",
    "type": "DataSet"
  },
  "context": {}
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
Transfer-Encoding: chunked
Date: Thu, 25 Jul 2013 15:45:25 GMT
{
  "entity-type": "document",
  "repository": "default",
  "uid": "ad9f8940-6aa8-450f-80fd-05af3f4836fb",
  "path": "/testDoc",
  "type": "DataSet",
  "state": "undefined",
  "versionLabel": "0.0",
  "title": "testDoc",
  "lastModified": "2013-07-25T15:45:25.03Z",
  "facets": [
    "Downloadable",
    "Commentable",
    "Versionable",
    "Publishable",
    "Thumbnail",
    "HasRelatedText"
  ],
  "changeToken": "1374767125039",
  "contextParameters": {}
}

HTTP Signature - Complex Properties - Document.Update

POST /nuxeo/site/automation/Document.Update HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Content-Type: application/json+nxrequest
Accept: application/json+nxentity, */*
Content-Length: 465
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.4 (java 1.5)

{
  "input": "doc:ad9f8940-6aa8-450f-80fd-05af3f4836fb",
  "params": {
    "properties": "ds:fields=[    {        \"fieldType\":\"string\",        \"description\":\"desc fieldA\",        \"name\":\"fieldA\",        \"columnName\":\"colA\",        \"sqlTypeHint\":\"whatever\"    },    {        \"fieldType\":\"string\",        \"description\":\"desc fieldB\",        \"name\":\"fieldB\",        \"columnName\":\"colB\",        \"sqlTypeHint\":\"whatever\"    }]\n"
  },
  "context": {}
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
Transfer-Encoding: chunked
Date: Thu, 25 Jul 2013 15:45:25 GMT
{
  "entity-type": "document",
  "repository": "default",
  "uid": "ad9f8940-6aa8-450f-80fd-05af3f4836fb",
  "path": "/testDoc",
  "type": "DataSet",
  "state": "undefined",
  "versionLabel": "0.0",
  "title": "testDoc",
  "lastModified": "2013-07-25T15:45:25.08Z",
  "facets": [
    "Downloadable",
    "Commentable",
    "Versionable",
    "Publishable",
    "Thumbnail",
    "HasRelatedText"
  ],
  "changeToken": "1374767125085",
  "contextParameters": {}
}

Custom Marshaling

Scenario
  1. Create a Folder on / (Document.Create).
  2. Create three Files children.
  3. Call Resultset.PageProvider with "select&nbsp; dc:title ,&nbsp; dc:desciption ,&nbsp; ecm:type &nbsp;from Document where&nbsp; ecm:parentId &nbsp;= ?" with:

    1. queryParams = Folder uuid,
    2. pageSize = 2,
    3. page = 1.
  4. Verify that:

    1. pageCount=2
    2. the page contains two records,
    3. the content of returned recordset is correct.
Java Implementation

XXX Link the Java unit test

HTTP Capture

XXX Commented HTTP capture

Managing Business Objects

Scenario
  1. Create a client side 'Business' bean (simple POJO with getter/setter on properties).
  2. Register the POJO in client Marshaling engine.
  3. Call Business.BusinessCreateOperation with:

    • two properties:

      • name ,
      • parentPath : reference the parent of the document to create,
    • one input:

      • the POJO itself.
  4. Get the returned POJO (with id set).
  5. Update the POJO title.
  6. Call Business.BusinessUpdateOperation with:

    • one property:

      • id: references the document id to update
    • with one input:

      • the POJO itself.
  7. Verify that:

    • the id is not null,
    • the title was updated.
Java Implementation

GitHub link for Business Object operations tests suite

HTTP Capture

HTTP Signature - Business.BusinessCreateOperation

 POST /nuxeo/site/automation/Business.BusinessCreateOperation HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Content-Type: application/json+nxrequest
Accept: application/json+nxentity, */*
Content-Length: 206
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.4 (java 1.5)

{
  "input": {
    "entity-type": "BusinessBeanAdapter",
    "value": {
      "id": null,
      "type": "Note",
      "description": "File description",
      "title": "Note",
      "note": "Note Content"
    }
  },
  "params": {
    "name": "Note",
    "parentPath": "/"
  },
  "context": {}
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
Transfer-Encoding: chunked
Date: Thu, 25 Jul 2013 15:45:45 GMT
{
  "entity-type": "BusinessBeanAdapter",
  "value": {
    "type": "Note",
    "id": "d82d9824-20ca-402a-a586-790103a018b2",
    "description": "File description",
    "note": "Note Content",
    "title": "Note"
  }
}

HTTP Signature - Business.BusinessUpdateOperation

 POST /nuxeo/site/automation/Business.BusinessUpdateOperation HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
Content-Type: application/json+nxrequest
Accept: application/json+nxentity, */*
Content-Length: 212
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.4 (java 1.5)

{
  "input": {
    "entity-type": "BusinessBeanAdapter",
    "value": {
      "id": "d82d9824-20ca-402a-a586-790103a018b2",
      "type": "Note",
      "description": "File description",
      "title": "Update",
      "note": "Note Content"
    }
  },
  "params": {},
  "context": {}
}

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json+nxentity
Transfer-Encoding: chunked
Date: Thu, 25 Jul 2013 15:45:45 GMT
{
  "entity-type": "BusinessBeanAdapter",
  "value": {
    "type": "Note",
    "id": "d82d9824-20ca-402a-a586-790103a018b2",
    "description": "File description",
    "note": "Note Content",
    "title": "Update"
  }
}

Client Compatibility Matrix

Compatibility Level

This compatibility matrix focus on two aspects :

  • protocol compliance: capability to achieve simple usage scenario as defined inside the tests,
  • convenience features: additional conveniant features that may be provided on top of JSON-RPC library.

Protocol Compliance

Automation being a simple JSON-RPC, you should be able to do everything from every language as long as you can do JSON Marshaling and HTTP calls.

Hence for each test scenario, the target client library will be qualified with one of the three statuses:

  • Ok: built-in feature,
  • Easy: test can be achieved with minor tweak (like format JSON partially by hand ...),
  • Fail: feature is not possible or complex to use.

Convenience Features

This aspect is here to highlight the specific feature that may be provided by each client library implementation.

This feature list currently includes:

Static Check Before Call

Ability to check operation arguments and types before actually doing the server side call.

Working with Document Object

Ability to work fluently with Document objects:

  • fetch a document and retrieve it as a Document object,
  • update the Document object,
  • send it back to the server.
Background Upload/Download Pool

Manage HTTP threads pool for upload/download in background.

Caching

Support client side caching to provide minimal offline capability.

Advanced Exception Management

Retrieve advanced information about potential server side exception.

Advanced Authentication

Support integrated authentication (via portal_sso).

Layout Management

Support for fetching layouts definition associated to documents.

Compatibility Matrix

   Java ClientJavaScript ClientPython ClientPHP ClientC# ClientAndroid ClientDart Client
Compatibility         
 Base        
  Create and read docs      
  Pagination      
 Blobs        
  Direct Blob upload      
  Blob upload via batch manager       
  Blob update vua batch manager       
 Marshaling        
  Complex properties       
  Custom marshaling       
  Business Objects       
Convenience         
  Static checks       
  Working with documents       
  Background upload/download       
  Caching       
  Advanced Exception management       
  Advanced Authentication       
  Layout Management       

Running the Tests

Client Side Code

The client side code depends on the following underlying technologies:

  • JUnit tests for Java client,
  • NUnit tests for .Net client,
  • HTML/JS for JavaScript client,
  • Python script for Python client,
  • ? for PHP client,
  • ? for Dart client.

Server Side Code

Compatibility tests have to be run against the lastest version of Nuxeo CAP. For now, no specific additional module is required.

Keep in mind that the tests do create document on the tested Nuxeo instance, don't run it against a production server otherwise you will end up with garbage in your repository since tests don't enforce cleanup.