User Tools

Site Tools


content:activity:naf4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
content:activity:naf4 [23/06/2014 23:40]
Andrew Bettison [PROGRESS REPORT] update R13 and R14 (in progress)
content:activity:naf4 [14/07/2014 19:17]
Andrew Bettison [COMPLETION REPORT] add test code coverage information to R14
Line 48: Line 48:
   * <BOOKMARK:N4>**N4**.  In **[[#R2]]** and **[[#R3]]**, the token is embedded in the JSON output of ''GET /restful/rhizome/bundlelist.json'' and ''GET /restful/rhizome/newsince/<token>/bundlelist.json'' as an optional per-row attribute which is only present in the first row and in any row thereafter which is more recent than the row containing the previous token.   This means that any future changes which alter the row order will not introduce incompatibilities in any client which follows the correct semantic of always using the last token received when forming the ''GET /restful/rhizome/newsince/<token>/bundlelist.json'' URL.   * <BOOKMARK:N4>**N4**.  In **[[#R2]]** and **[[#R3]]**, the token is embedded in the JSON output of ''GET /restful/rhizome/bundlelist.json'' and ''GET /restful/rhizome/newsince/<token>/bundlelist.json'' as an optional per-row attribute which is only present in the first row and in any row thereafter which is more recent than the row containing the previous token.   This means that any future changes which alter the row order will not introduce incompatibilities in any client which follows the correct semantic of always using the last token received when forming the ''GET /restful/rhizome/newsince/<token>/bundlelist.json'' URL.
   * <BOOKMARK:N5>**N5**.  In **[[#R3]]**, ''GET /restful/rhizome/newsince/<token>/bundlelist.json'' returns bundles in chronological order (oldest first).  This is because the temporally incremental nature of the request makes it impossible to return bundles in reverse chronological order (as in **[[#N3]]**) except by waiting for the end of the 60-second timeout and sending them all in a single burst, which would not yield the kind of immediate interactive functionality that is desired.  One consequence of this is that every row will contain a new token (see **[[#N4]]**), which has the benefit that the HTTP client can close the connection at any point and initiate a new request using the latest token it received, without missing any bundles.   * <BOOKMARK:N5>**N5**.  In **[[#R3]]**, ''GET /restful/rhizome/newsince/<token>/bundlelist.json'' returns bundles in chronological order (oldest first).  This is because the temporally incremental nature of the request makes it impossible to return bundles in reverse chronological order (as in **[[#N3]]**) except by waiting for the end of the 60-second timeout and sending them all in a single burst, which would not yield the kind of immediate interactive functionality that is desired.  One consequence of this is that every row will contain a new token (see **[[#N4]]**), which has the benefit that the HTTP client can close the connection at any point and initiate a new request using the latest token it received, without missing any bundles.
-  * <BOOKMARK:N6>**N6**.  In **[[#R4]]** and **[[#R5]]**, the HTTP response contains the following extra headers to make it functionally equivalent to the ''servald rhizome export manifest'' command:<code>+  * <BOOKMARK:N6>**N6**.  In **[[#R4]]****[[#R5]]**, **[[#R6]]** and **[[#R7]]**, the HTTP response contains the following extra headers that describe the outcome of the Rhizome payload operation and the bundle operation:<code
 +Serval-Rhizome-Result-Payload-Status-Code: -1|0|1|2|3|4|5|6|7 
 +Serval-Rhizome-Result-Payload-Status-Message: <text> 
 +Serval-Rhizome-Result-Bundle-Status-Code: -1|0|1|2|3|4|5|6|7|8 
 +Serval-Rhizome-Result-Bundle-Status-Code: <text>
 Serval-Rhizome-Bundle-Id: <BundleIDHex> Serval-Rhizome-Bundle-Id: <BundleIDHex>
 Serval-Rhizome-Bundle-Version: <ASCIIDecimal> Serval-Rhizome-Bundle-Version: <ASCIIDecimal>
Line 54: Line 58:
 Serval-Rhizome-Bundle-Filehash: <FilehashHex> Serval-Rhizome-Bundle-Filehash: <FilehashHex>
 Serval-Rhizome-Bundle-BK: <BundleKeyHex> Serval-Rhizome-Bundle-BK: <BundleKeyHex>
 +Serval-Rhizome-Bundle-Crypt: 0|1
 +Serval-Rhizome-Bundle-Tail: <ASCIIDecimal>
 Serval-Rhizome-Bundle-Date: <ASCIIDecimal> Serval-Rhizome-Bundle-Date: <ASCIIDecimal>
 Serval-Rhizome-Bundle-Name: <NameQuotedString> Serval-Rhizome-Bundle-Name: <NameQuotedString>
Line 62: Line 68:
 Serval-Rhizome-Bundle-Inserttime: <ASCIIDecimal> Serval-Rhizome-Bundle-Inserttime: <ASCIIDecimal>
 </code> </code>
 +    * The ''Serval-Rhizome-Result-Payload-Status-Code'' values are encapsulated in the new Java class [[https://github.com/servalproject/serval-dna/blob/development/java/org/servalproject/servaldna/rhizome/RhizomePayloadStatus.java|org.servalproject.servaldna.rhizome.RhizomePayloadStatus]]
 +    * The ''Serval-Rhizome-Result-Bundle-Status-Code'' values are encapsulated in the new Java class [[https://github.com/servalproject/serval-dna/blob/development/java/org/servalproject/servaldna/rhizome/RhizomeBundleStatus.java|org.servalproject.servaldna.rhizome.RhizomeBundleStatus]]
     * The ''Serval-Rhizome-Bundle-Filehash'' header is only present if the bundle filesize is nonzero.     * The ''Serval-Rhizome-Bundle-Filehash'' header is only present if the bundle filesize is nonzero.
 +    * The ''Serval-Rhizome-Bundle-BK'' header is only present if the manifest contains a Bundle Key (''BK'') field
 +    * The ''Serval-Rhizome-Bundle-Crypt'' header is only present if the manifest contains a ''crypt'' field
 +    * The ''Serval-Rhizome-Bundle-Tail'' header is only present if the manifest contains a ''tail'' field, ie, is a journal
 +    * The ''Serval-Rhizome-Bundle-Date'' header is only present if the manifest contains a ''date'' field
 +    * The ''Serval-Rhizome-Bundle-Name'' header is only present if the manifest contains a ''name'' field
 +    * The ''Serval-Rhizome-Bundle-Service'' header is only present if the manifest contains a ''service'' field
     * The ''Serval-Rhizome-Bundle-Author'' header is only present if the identity that created the bundle is present and currently unlocked in the keyring.     * The ''Serval-Rhizome-Bundle-Author'' header is only present if the identity that created the bundle is present and currently unlocked in the keyring.
     * The ''Serval-Rhizome-Bundle-Secret'' header ditto.     * The ''Serval-Rhizome-Bundle-Secret'' header ditto.
     * The ''Serval-Rhizome-Bundle-Rowid'' header exposes an implementation detail of the Rhizome storage database, and as such, is not guaranteed to be present.     * The ''Serval-Rhizome-Bundle-Rowid'' header exposes an implementation detail of the Rhizome storage database, and as such, is not guaranteed to be present.
-  * <BOOKMARK:N7>**N7**.  In **[[#R7]]** the ''POST /restful/rhizome/insert'' request cannot be used to inject a [[:content:tech:rhizome_journal|Journal Bundle]] -- a future "append" operation will have to be implemented to support Journals.+  * <BOOKMARK:N7>**N7**.  In **[[#R7]]** the ''POST /restful/rhizome/insert'' request cannot be used to inject a [[:content:tech:rhizome_journal|Journal Bundle]], and produces 501 "Not Implemented" HTTP response. future "journal append" operation will have to be implemented to support Rhizome journals.
   * <BOOKMARK:N8>**N8**.  The HTTP status code 403 "Forbidden" is returned if a request is well-formed by the rules of HTTP and obeys the RESTful API, but provokes a failure response that is not the fault of the caller nor a defect in the interface, for example running out of space in the Rhizome store, or missing a necessary bundle   * <BOOKMARK:N8>**N8**.  The HTTP status code 403 "Forbidden" is returned if a request is well-formed by the rules of HTTP and obeys the RESTful API, but provokes a failure response that is not the fault of the caller nor a defect in the interface, for example running out of space in the Rhizome store, or missing a necessary bundle
   * <BOOKMARK:N9>**N9**.  Except where otherwise specified, all RESTful operations return a JSON response, ie, ''Content-Type: application/json'' Error results return a single JSON object that contains the HTTP status code and a textual message:<code>   * <BOOKMARK:N9>**N9**.  Except where otherwise specified, all RESTful operations return a JSON response, ie, ''Content-Type: application/json'' Error results return a single JSON object that contains the HTTP status code and a textual message:<code>
Line 72: Line 86:
    "http_status_code": 403,    "http_status_code": 403,
    "http_status_message": "Missing form parameter"    "http_status_message": "Missing form parameter"
 +}
 +</code>
 +  * <BOOKMARK:N9a>**N9(a)**. The JSON object returned from Rhizome operations **[[#R4]]**, **[[#R5]]**, **[[#R6]]** and **[[#R7]]** contains four extra fields describing the outcome of the Rhizome payload operation and the bundle operation:<code>
 +{
 +   "http_status_code": 200,
 +   "http_status_message": "OK",
 +   "rhizome_payload_status_code": 2,
 +   "rhizome_payload_status_message": "Payload already in store"
 +   "rhizome_bundle_status_code": 3,
 +   "rhizome_bundle_status_message": "Newer bundle already in store"
 +}
 +</code>
 +  * <BOOKMARK:N9b>**N9(b)**. The JSON object returned from MeshMS operations **[[#R10]]**, **[[#R11]]** and **[[#R12]]** contains two extra fields describing the outcome of the MeshMS operation:<code>
 +{
 +   "http_status_code": 201,
 +   "http_status_message": "Created",
 +   "meshms_status_code": 1,
 +   "meshms_status_message": "Bundle updated"
 } }
 </code> </code>
Line 109: Line 141:
     * ''POST /restful/meshms/<SID>/<SID>/recv/<offset>/read'' advances the read-offset in a single conversation, to mark a single message (and all its predecessors) as read     * ''POST /restful/meshms/<SID>/<SID>/recv/<offset>/read'' advances the read-offset in a single conversation, to mark a single message (and all its predecessors) as read
  
-===== PROGRESS REPORT =====+===== COMPLETION REPORT ===== 
 + 
 +The work was completed on 14 July 2014, having been performed concurrently with three other contracts: 
 +  * [[naf5]] 
 +  * [[naf6]] 
 +  * [[openitp2]]
  
 ==== Preliminary work ==== ==== Preliminary work ====
 +
 +This contract drove several significant architectural improvements to [[:content:servaldna:]] and [[:content:servalmesh:]].
  
 == Security: SQL injections == == Security: SQL injections ==
Line 133: Line 172:
   * The existing Rhizome HTTP interfaces (Rhizome HTTP transport and [[:content:tech:Rhizome Direct]]) were rewritten to use the new HTTP request parser.   * The existing Rhizome HTTP interfaces (Rhizome HTTP transport and [[:content:tech:Rhizome Direct]]) were rewritten to use the new HTTP request parser.
   * The new HTTP request parser is modular and is not tied to the existing Rhizome implementation, so it may easily be re-used to implement other HTTP interfaces in future.   * The new HTTP request parser is modular and is not tied to the existing Rhizome implementation, so it may easily be re-used to implement other HTTP interfaces in future.
 +
 +== Re-organisation around RESTful API ==
 +Henceforward the RESTful API will be the preferred (and eventually only) method for applications to use Rhizome and MeshMS.
 +  * The existing JNI API for Rhizome and MeshMS was inferior:
 +    * the JNI API provided function-call entry points into the Serval DNA shared library
 +    * application processes opened and accessed the Rhizome database themselves, not via requests to the daemon
 +    * this sometimes caused database locking to block the daemon, which severely degraded responsiveness when starting a freshly-installed Batphone app in the presence of other devices holding lots of Rhizome content -- see [[https://github.com/servalproject/serval-dna/issues/1|Serval DNA issue #1]]
 +    * all Android applications using MeshMS and Rhizome had to be bundled together in a single APK, so that Android would run them all with the same User ID, so they could all access and modify the Rhizome database files
 +  * Commit [[https://github.com/servalproject/serval-dna/commit/68dbaef38d03535271eed14a6da35323a0dd7a4f|68dbaef]] refactored the Java API to add a stateful object that holds an open connection to the daemon, and keep the Serval DNA RESTful interface independent from the JNI command interface
 +  * Commit [[https://github.com/servalproject/serval-dna/commit/82b13caac4c2386a096acc5c72ebde2b4871c245|82b13ca]] deprecated the existing MeshMS JNI API
 +  * Commit [[https://github.com/servalproject/serval-dna/commit/11e9d382995da9fc2c0342abcc52623cc8a80781|11e9d38]] renamed the Serval DNA configuration ''rhizome.api.restful.'' options to ''api.restful.'' because the RESTful interface will be used for services other than Rhizome (eg, MeshMS)
 +
 +== Serval DNA power consumption ==
 +The final issue to be addressed was the CPU activity of the [[:content:servaldna:]] daemon whilst idle.
 +  * The previous implementation of the [[:content:servalmesh:|Serval Mesh app for Android]] did not have a continuously running daemon:
 +    * the daemon only ran while the "Enable Services" checkbox was ticked on the "Connect" menu
 +    * the daemon awoke periodically on *alarm* events (once per second) while running, even while the network was idle or no network interfaces were up
 +    * this caused rapid battery drain while Serval Mesh networking was active, which was advised in the [[https://github.com/servalproject/batphone/blob/0.91/doc/RELEASE-0.91.md|Release Notes for 0.91]]
 +    * the JNI API (see above) accessed the Rhizome database directly in-process; it did not use the daemon, so the Rhizome and MeshMS screens functioned at all times
 +  * The new implementation (**[[#R15]]**) implements MeshMS operations using the RESTful HTTP interface:
 +    * this requires a continuously running daemon, or at least a daemon running while any Rhizome or MeshMS screen are active
 +    * this could quickly drain the battery simply by opening the app
 +  * This necessitated improvements to the event scheduling sub-system within [[:content:servaldna:]]:
 +    * only use CPU in response to real external events (user and network)
 +    * only schedule timed wake-ups for externally imposed timing requirements such as network protocol time-outs
 +  * Commit [[https://github.com/servalproject/serval-dna/commit/6d4ad0e1505d8826cda024159892b82699e392c7|6d4ad0e]] improved the event alarm scheduler [[https://github.com/servalproject/serval-dna/blob/development/fdqueue.c|fdqueue.c]]:
 +    * a new kind of "lazy" alarm does not force the daemon process to wake
 +    * whenever the daemon does wake due to network or user activity, overdue lazy alarms are run in time order
 +    * existing periodic events, such as the configuration file poll and shutdown file poll, were re-implemented to use lazy alarms
 +    * this allowed **[[#R15]]** to be implemented without any impact on battery life
 +  * Commit [[https://github.com/servalproject/batphone/commit/f0948b2bb0cc8b9ca3bf89dd743df30dacbc3620|f0948b2]] improved the [[:content:servalmesh:]] app:
 +    * starts the daemon as needed and keeps it running
 +    * changing the "Enable Services" checkbox simply toggles a Serval DNA configuration option
 +  * This improvement has significant positive repercussions for other Serval products like [[:content:meshextender:]], by extending battery life towards the maximum practical limit
  
 ==== Implementation ==== ==== Implementation ====
Line 145: Line 218:
   * commit [[https://github.com/servalproject/serval-dna/commit/b44046d6121167688892def3163a53f7d84126a2|b44046d]] improved the empty ''/restful/rhizome/bundlelist.json'' resource to return a 403 Forbidden response unless the request arrives over the local loopback interface   * commit [[https://github.com/servalproject/serval-dna/commit/b44046d6121167688892def3163a53f7d84126a2|b44046d]] improved the empty ''/restful/rhizome/bundlelist.json'' resource to return a 403 Forbidden response unless the request arrives over the local loopback interface
   * all the checks in the ''/restful/rhizome/bundlelist.json'' resource were factored into a function that was re-used to implement the other resources   * all the checks in the ''/restful/rhizome/bundlelist.json'' resource were factored into a function that was re-used to implement the other resources
 +  * commit [[https://github.com/servalproject/serval-dna/commit/067340bbba734c8b505a94815798f5a1ddd5283a|067340b]] renamed the HTTP Authorisation realm from "Serval Rhizome" to "Serval RESTful API"
  
 **[[#R2]]** -- **''GET /restful/rhizome/bundlelist.json''** request **[[#R2]]** -- **''GET /restful/rhizome/bundlelist.json''** request
Line 196: Line 270:
   * commit [[https://github.com/servalproject/serval-dna/commit/6a1c8bcf5ac34962d7dff363d507e285e829d9a6|6a1c8bc]] implemented **[[#N8]]** and **[[#N9]]** so that all responses are in JSON format except where otherwise specified   * commit [[https://github.com/servalproject/serval-dna/commit/6a1c8bcf5ac34962d7dff363d507e285e829d9a6|6a1c8bc]] implemented **[[#N8]]** and **[[#N9]]** so that all responses are in JSON format except where otherwise specified
  
-**[[#R9]]** -- **''GET /restful/meshms/<SID>/conversationlist.json''** request (completed 22 January 2014)+**[[#R9]]** -- **''GET /restful/meshms/<SID>/conversationlist.json''** request (completed 22 January 2014, fixed 26 June 2014)
   * commits [[https://github.com/servalproject/serval-dna/commit/5c1ebc71a9efdd41e29eb2cdfd30414965fe8e86|5c1ebc7]], [[https://github.com/servalproject/serval-dna/commit/e3e3e1e046c24a55ec8e19237b4190e27791d6a5|e3e3e1e]], [[https://github.com/servalproject/serval-dna/commit/cb420c61e385e543b5895992037df729181f5fe0|cb420c6]] and [[https://github.com/servalproject/serval-dna/commit/94274ba5fab5a2ebce2a5e006a8589363bacd2ec|94274ba]] refactored MeshMS and HTTP ''GET /restful/rhizome/bundlelist.json'' code for re-use   * commits [[https://github.com/servalproject/serval-dna/commit/5c1ebc71a9efdd41e29eb2cdfd30414965fe8e86|5c1ebc7]], [[https://github.com/servalproject/serval-dna/commit/e3e3e1e046c24a55ec8e19237b4190e27791d6a5|e3e3e1e]], [[https://github.com/servalproject/serval-dna/commit/cb420c61e385e543b5895992037df729181f5fe0|cb420c6]] and [[https://github.com/servalproject/serval-dna/commit/94274ba5fab5a2ebce2a5e006a8589363bacd2ec|94274ba]] refactored MeshMS and HTTP ''GET /restful/rhizome/bundlelist.json'' code for re-use
   * commit [[https://github.com/servalproject/serval-dna/commit/8897563d09963c0f39ec15e3e5bfe25b41ab870a|8897563]] implemented the request and a test case, based on the existing MeshMS CLI test, that creates three conversations, runs the HTTP request, then marks the conversations as read and runs the HTTP request again   * commit [[https://github.com/servalproject/serval-dna/commit/8897563d09963c0f39ec15e3e5bfe25b41ab870a|8897563]] implemented the request and a test case, based on the existing MeshMS CLI test, that creates three conversations, runs the HTTP request, then marks the conversations as read and runs the HTTP request again
 +  * commit [[https://github.com/servalproject/serval-dna/commit/6c16b95a384852de3da2b80bf15521385b550bba|6c16b95]] fixed a SEGV bug when requesting an empty conversation list
  
 **[[#R10]]** -- **''GET /restful/meshms/<fromSID>/<toSID>/messagelist.json''** request (see **[[#V3]]**) (completed 24 January 2014) **[[#R10]]** -- **''GET /restful/meshms/<fromSID>/<toSID>/messagelist.json''** request (see **[[#V3]]**) (completed 24 January 2014)
Line 220: Line 295:
   * commit [[https://github.com/servalproject/serval-dna/commit/0727fb3b62ad6ff6c23154ef2853314ae28eeabf|0727fb3]] merged all work up to **[[#R12]]** into the mainline development branch   * commit [[https://github.com/servalproject/serval-dna/commit/0727fb3b62ad6ff6c23154ef2853314ae28eeabf|0727fb3]] merged all work up to **[[#R12]]** into the mainline development branch
  
-**[[#R13]]** -- Java API (in progress, 19 June 2014)+**[[#R13]]** -- Java API (completed 14 July 2014) 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/99fb8b6108021842ddaa82d95e17fe1f2f1347b8|99fb8b6]] moved the Java API foundation classes from the Batphone source repository to the Serval DNA repository
   * commit [[https://github.com/servalproject/serval-dna/commit/d879189299b2978b5cb419f7eb91f42a89479407|d879189]] fixed a bug in Serval DNA's HTTP server code (from **[[#R1a]]**) that produced a 500 Server Error if the Basic Authorization string was long   * commit [[https://github.com/servalproject/serval-dna/commit/d879189299b2978b5cb419f7eb91f42a89479407|d879189]] fixed a bug in Serval DNA's HTTP server code (from **[[#R1a]]**) that produced a 500 Server Error if the Basic Authorization string was long
   * commit [[https://github.com/servalproject/serval-dna/commit/9cbd7c365cc1a9c1f94ff4503d06b520a4e06f49|9cbd7c3]] implemented a Java API to list MeshMS conversations:   * commit [[https://github.com/servalproject/serval-dna/commit/9cbd7c365cc1a9c1f94ff4503d06b520a4e06f49|9cbd7c3]] implemented a Java API to list MeshMS conversations:
Line 233: Line 309:
     * new class [[https://github.com/servalproject/serval-dna/blob/development/java/org/servalproject/servaldna/meshms/MeshMSMessageList.java|org.servalproject.servaldna.meshmes.MeshMSMessageList]]     * new class [[https://github.com/servalproject/serval-dna/blob/development/java/org/servalproject/servaldna/meshms/MeshMSMessageList.java|org.servalproject.servaldna.meshmes.MeshMSMessageList]]
   * commit [[https://github.com/servalproject/serval-dna/commit/819b8dc9e73b8b9199fbe949af195aa9a12cde96|819b8dc]] improved the Serval DNA HTTP server to be strict about the Content-Disposition and Content-Type form-part headers supplied in POST requests   * commit [[https://github.com/servalproject/serval-dna/commit/819b8dc9e73b8b9199fbe949af195aa9a12cde96|819b8dc]] improved the Serval DNA HTTP server to be strict about the Content-Disposition and Content-Type form-part headers supplied in POST requests
-  * commit [[https://github.com/servalproject/serval-dna/commit/68dbaef38d03535271eed14a6da35323a0dd7a4f|68dbaef]] refactored the Java API to keep the Serval DNA RESTful interface separate from, and not dependent upon the JNI command interface+  * commit [[https://github.com/servalproject/serval-dna/commit/b14c58bdf68cc51c8fbf32e22b84da2db8584a6a|b14c58b]] merged the MeshMS Java API for listing conversations and messages into the development branch for use in Batphone (**[[#R15]]**)
   * commit [[https://github.com/servalproject/serval-dna/commit/eba7f6555f22aa4be8ba1fe99cd25ba632826349|eba7f65]] implemented the Java API to send a MeshMS message:   * commit [[https://github.com/servalproject/serval-dna/commit/eba7f6555f22aa4be8ba1fe99cd25ba632826349|eba7f65]] implemented the Java API to send a MeshMS message:
     * uses the RESTful HTTP interface developed in **[[#R12]]**     * uses the RESTful HTTP interface developed in **[[#R12]]**
-    * new class [[https://github.com/servalproject/serval-dna/blob/development/java/org/servalproject/servaldna/meshms/MeshMSCommon.java|org.servalproject.servaldna.meshms.MeshMSCommon]] contains methods for parsing a MeshMS status report JSON+    * new class [[https://github.com/servalproject/serval-dna/blob/development/java/org/servalproject/servaldna/meshms/MeshMSCommon.java|org.servalproject.servaldna.meshms.MeshMSCommon]] contains methods for parsing a MeshMS status report JSON (**[[#N9b]]**)
   * commit [[https://github.com/servalproject/serval-dna/commit/7736a4ceb1beefeee4adc2e427b73164feeb6c59|7736a4c]] implemented three new MeshMS RESTful HTTP requests (**[[#N16]]**)   * commit [[https://github.com/servalproject/serval-dna/commit/7736a4ceb1beefeee4adc2e427b73164feeb6c59|7736a4c]] implemented three new MeshMS RESTful HTTP requests (**[[#N16]]**)
-  * commit [[https://github.com/servalproject/serval-dna/commit/c79a382a27252c6fa201d68a24a244c52c0685c0|c79a382]] implemented the Java API to mark messages as read+  * commit [[https://github.com/servalproject/serval-dna/commit/c79a382a27252c6fa201d68a24a244c52c0685c0|c79a382]] implemented the MeshMS Java API to mark messages as read 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/660daf04382a8f78bda935cff4cb03b03ddc0fa4|660daf0]] merged the completed MeshMS Java API into the development branch for use in Batphone (**[[#R15]]**) 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/1ac67de0e9407cd827f87535c66f8144f34bcec3|1ac67de]] fixed a bug in Serval DNA's HTTP form-data MIME part parsing that was revealed by the new Java API 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/61023287b16e25d7a4e504ddc0815ed2125f1943|6102328]] improved Serval DNA's Rhizome manifest validation code to provide a textual reason for failure, which can be passed back to API clients to assist diagnosis 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/db8ee79a4ee11bc0ddf48e9c451fa813b9844851|db8ee79]] implemented a Java API to list Rhizome bundles: 
 +    * uses the RESTful HTTP interface developed in **[[#R2]]** 
 +    * new class [[https://github.com/servalproject/serval-dna/blob/development/java/org/servalproject/servaldna/rhizome/RhizomeCommon.java|org.servalproject.servaldna.rhizome.RhizomeCommon]] contains methods for parsing a Rhizome status report JSON (**[[#N9a]]**) 
 +    * new class [[https://github.com/servalproject/serval-dna/blob/development/java/org/servalproject/json/JSONTableScanner.java|org.servalproject.json.JSONTableScanner]] generalises the parsing of the JSON table structure returned by Rhizome and MeshMS lists (**[[#N1]]** and **[[#N10]]**) 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/93e67ede635930e678ac2714b0436de733a53c3d|93e67ed]] implemented a Java API to fetch a Rhizome manifest given its Bundle ID: 
 +    * uses the RESTful HTTP interface developed in **[[#R4]]** 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/34b6ff48bf9c44808867c3d37e2c4fc9677dcdd7|34b6ff4]] implemented a Java API to fetch a "raw" Rhizome payload (not decrypted) given its Bundle ID 
 +    * uses the RESTful HTTP interface developed in **[[#R5]]** 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/cf4363578988cafa23301d8b0c1cb8a3db3c08b9|cf43635]] improved Serval DNA's internal handling of Rhizome payload and bundle operation outcome enums, and reports these status enum codes and messages via the RESTful API (**[[#N6]]** and **[[#N9a]]**) 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/d16be8f42d75fe4715ed6197927a01fcde2f39dc|d16be8f]] added ''meshms_status_message'' to the result returned by MeshMS RESTful operations (**[[#N9b]]**) 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/2aec8f31a4ea71196d6041a3a59421884caaa0f0|2aec8f3]] implemented a Java API to fetch a decrypted Rhizome payload given its Bundle ID 
 +    * uses the RESTful HTTP interface developed in **[[#R6]]** 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/a81d05b4f6db84c732e7c2c59a7288e4d16fe29d|a81d05b]] implemented a Java API to insert a new Rhizome bundle 
 +    * uses the RESTful HTTP interface developed in **[[#R7]]** 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/57cce64b6cdf988a3437ce2f98edc16492ae4e35|57cce64]] narrowed the classes of exceptions thrown by Rhizome Java API methods, to make the API more self-documenting 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/04b2a20e54fc8d55dc6187ad21cf3c533d385b3c|04b2a20]] improved the Content-Type header and added Content-Transfer-Encoding headers sent by the Java API *insert bundle* operation, to help future-proof the protocol 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/8842f32b193876723dce5807fcaadd791ed75a5e|8842f32]] ensured that inserting a journal bundle returns the 501 "Not Implemented" HTTP code (**[[#N7]]**) 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/606f087dd5fe3cc3a22569ae2050dea447b2d2bf|606f087]] merged the almost-complete Rhizome Java API into the development branch for use in Batphone (**[[#R15]]**) 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/4c6612a61e2e5ce46d840bf6f0ae3771a6583446|4c6612a]] implemented a Java API to list Rhizome bundles that have arrived since a given token: 
 +    * uses the RESTful HTTP interface developed in **[[#R3]]** 
 +  * commit [[https://github.com/servalproject/serval-dna/commit/89623015fcfb75a6b8adccb6bf785a9e46cb26e5|8962301]] implemented a Java API to list MeshMS messages that have arrived since a given token from a single conversation: 
 +    * uses the RESTful HTTP interface developed in **[[#R11]]**
  
-**[[#R14]]** -- Automated tests (in progress, 19 June 2014)+**[[#R14]]** -- Automated tests (completed 11 July 2014)
  
   * The **[[https://github.com/servalproject/serval-dna/blob/development/tests/meshms|tests/meshms]]** script contains all the tests that were created when the MeshMS protocol was moved from [[:content:servalmesh:]] (Java) into [[:content:servaldna:]] (C) (**[[#R8]]**).   * The **[[https://github.com/servalproject/serval-dna/blob/development/tests/meshms|tests/meshms]]** script contains all the tests that were created when the MeshMS protocol was moved from [[:content:servalmesh:]] (Java) into [[:content:servaldna:]] (C) (**[[#R8]]**).
  
-  * The new **[[https://github.com/servalproject/serval-dna/blob/development/tests/rhizomehttp|rhizomehttp]]** test script contains all tests for the new RESTful HTTP API:+  * Created the new **[[https://github.com/servalproject/serval-dna/blob/5df5a337215c33d79240025566186266901d318c/tests/rhizomehttp|rhizomehttp]]** test script containing tests for the new RESTful HTTP API (later split into **[[https://github.com/servalproject/serval-dna/blob/development/tests/rhizomerestful|rhizomerestful]]** and **[[https://github.com/servalproject/serval-dna/blob/development/tests/meshmsrestful|meshmsrestful]]**):
     * commits [[https://github.com/servalproject/serval-dna/commit/3d3e900e727fac20f1984ced519de948d073b9ca#diff-1|3d3e900]], [[https://github.com/servalproject/serval-dna/commit/21fe12859fe95b5b1812dc85ef3911519ed83149#diff-3|21fe128]] and [[https://github.com/servalproject/serval-dna/commit/2ac1bc32403ecbf3deb54073bb02d8effa4e6264#diff-1|2ac1bc3]] added test cases for Basic Authentication (**[[#R1a]]**) and **bundlelist.json** (**[[#R2]]**)     * commits [[https://github.com/servalproject/serval-dna/commit/3d3e900e727fac20f1984ced519de948d073b9ca#diff-1|3d3e900]], [[https://github.com/servalproject/serval-dna/commit/21fe12859fe95b5b1812dc85ef3911519ed83149#diff-3|21fe128]] and [[https://github.com/servalproject/serval-dna/commit/2ac1bc32403ecbf3deb54073bb02d8effa4e6264#diff-1|2ac1bc3]] added test cases for Basic Authentication (**[[#R1a]]**) and **bundlelist.json** (**[[#R2]]**)
     * commits [[https://github.com/servalproject/serval-dna/commit/6b961c56ce24a46ad58ebe744ca87e47c49adadd#diff-3|6b961c5]], [[https://github.com/servalproject/serval-dna/commit/13634f8748997b05f1002bd026bcbd398d194fe2#diff-7|13634f8]], [[https://github.com/servalproject/serval-dna/commit/4380fdcccd5111648092b5262d9d80244216832d#diff-3|4380fdc]] and [[https://github.com/servalproject/serval-dna/commit/f8f7716544ceb0abdbe3a3b41c90304c018e9ad9#diff-2|f8f7716]] improved the test case for **bundlelist.json** (**[[#R2]]**)     * commits [[https://github.com/servalproject/serval-dna/commit/6b961c56ce24a46ad58ebe744ca87e47c49adadd#diff-3|6b961c5]], [[https://github.com/servalproject/serval-dna/commit/13634f8748997b05f1002bd026bcbd398d194fe2#diff-7|13634f8]], [[https://github.com/servalproject/serval-dna/commit/4380fdcccd5111648092b5262d9d80244216832d#diff-3|4380fdc]] and [[https://github.com/servalproject/serval-dna/commit/f8f7716544ceb0abdbe3a3b41c90304c018e9ad9#diff-2|f8f7716]] improved the test case for **bundlelist.json** (**[[#R2]]**)
Line 292: Line 393:
       - mark a single message as read in a single conversation       - mark a single message as read in a single conversation
       - supply spurious content body to a POST request       - supply spurious content body to a POST request
 +    * commit [[https://github.com/servalproject/serval-dna/commit/776d4de894aa7543beef1fa03f63b3b4793ca630|776d4de]] split the [[https://github.com/servalproject/serval-dna/blob/5df5a337215c33d79240025566186266901d318c/tests/rhizomehttp|rhizomehttp]] test script into [[https://github.com/servalproject/serval-dna/blob/development/tests/rhizomerestful|rhizomerestful]] and [[https://github.com/servalproject/serval-dna/blob/development/tests/meshmsrestful|meshmsrestful]]
 +
 +  * Created the new **[[https://github.com/servalproject/serval-dna/blob/development/tests/meshmsjava|meshmsjava]]** test script containing tests for the new MeshMS Java API:
 +    * commit [[https://github.com/servalproject/serval-dna/commit/9cbd7c365cc1a9c1f94ff4503d06b520a4e06f49#diff-8|9cbd7c3]] added a new test case for "Java API MeshMS list conversations" (**[[#R13]]**, **[[#R9]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/e9437e9a61ad6248c6ae0084521ffafc51c09b68#diff-10|e9437e9]] added two new test cases for "Java API MeshMS list messages" (**[[#R13]]**, **[[#R10]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/89623015fcfb75a6b8adccb6bf785a9e46cb26e5#diff-0371afbd127921209ea37daba1e3ef47|8962301]] added two new test cases for "Java API MeshMS list new messages since token" (**[[#R13]]**, **[[#R11]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/eba7f6555f22aa4be8ba1fe99cd25ba632826349#diff-0371afbd127921209ea37daba1e3ef47|eba7f65]] added two new test cases for "Java API MeshMS send message" (**[[#R13]]**, **[[#R12]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/c79a382a27252c6fa201d68a24a244c52c0685c0#diff-0371afbd127921209ea37daba1e3ef47|c79a382]] added three new test cases for "Java API MeshMS mark messages as read" (**[[#R13]]**, **[[#N16]]**)
 +
 +  * Created the new **[[https://github.com/servalproject/serval-dna/blob/development/tests/rhizomejava|rhizomejava]]** test script containing tests for the new Rhizome Java API:
 +    * commit [[https://github.com/servalproject/serval-dna/commit/a9ec5dcf695ece8363f838fc71cd25f92a1ed0bc|a9ec5dc]] refactored some shell functions from the existing [[https://github.com/servalproject/serval-dna/blob/development/tests/rhizomerestful|rhizomerestful]] script into [[https://github.com/servalproject/serval-dna/blob/development/testdefs_rhizome.sh|testdefs_rhizome.sh]] ready for re-use
 +    * commit [[https://github.com/servalproject/serval-dna/commit/db8ee79a4ee11bc0ddf48e9c451fa813b9844851#diff-4601ee6fcb99859fee9b658744fa9024|db8ee79]] created the new script and added a test case for "Java API Rhizome list bundles" (**[[#R13]]**, **[[#R2]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/4c6612a61e2e5ce46d840bf6f0ae3771a6583446#diff-4601ee6fcb99859fee9b658744fa9024|4c6612a]] added a test case for "Java API Rhizome list new bundles since a token" (**[[#R13]]**, **[[#R3]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/93e67ede635930e678ac2714b0436de733a53c3d#diff-4601ee6fcb99859fee9b658744fa9024|93e67ed]] added a test case for "Java API Rhizome fetch manifest" (**[[#R13]]**, **[[#R4]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/34b6ff48bf9c44808867c3d37e2c4fc9677dcdd7#diff-4601ee6fcb99859fee9b658744fa9024|34b6ff4]] added a test case for "Java API Rhizome fetch raw payload" (**[[#R13]]**, **[[#R5]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/2aec8f31a4ea71196d6041a3a59421884caaa0f0#diff-4601ee6fcb99859fee9b658744fa9024|2aec8f3]] added a test case for "Java API Rhizome fetch decrypted payload" (**[[#R13]]**, **[[#R6]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/3715c5bf0b2be95bc773eb7e8225079cb55d7c81#diff-4601ee6fcb99859fee9b658744fa9024|3715c5b]] added four negative test cases for "Java API Rhizome fetch" (**[[#R13]]**, **[[#R4]]**, **[[#R5]]**, **[[#R6]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/a81d05b4f6db84c732e7c2c59a7288e4d16fe29d#diff-4601ee6fcb99859fee9b658744fa9024|a81d05b]] added a test case for "Java API Rhizome insert bundle" (**[[#R13]]**, **[[#R7]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/a87133d4d361edd602617092f54040e21f5335a3#diff-4601ee6fcb99859fee9b658744fa9024|a87133d]] added a negative test case for "Java API Rhizome insert bundle" (**[[#R13]]**, **[[#R7]]**) -- can update an anonymous bundle if secret is provided
 +    * commit [[https://github.com/servalproject/serval-dna/commit/e35bf77938a036b059f926e3d00d23dd3d2f027c#diff-4601ee6fcb99859fee9b658744fa9024|e35bf77]] added two test cases for inserting empty payloads (**[[#R13]]**, **[[#R7]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/8842f32b193876723dce5807fcaadd791ed75a5e#diff-4601ee6fcb99859fee9b658744fa9024|8842f32]] added a test case for inserting journal bundle not implemented (**[[#R13]]**, **[[#N7]]**)
 +    * commit [[https://github.com/servalproject/serval-dna/commit/2757a08b87d3614f48f6e7c528280de25332dbff#diff-4601ee6fcb99859fee9b658744fa9024|2757a08]] added two negative cases for inserting an inconsistent bundle (**[[#R13]]**, **[[#N7]]**)
 +
 +  * The Java tests were added to the [[https://github.com/servalproject/serval-dna/blob/development/tests/all|tests/all]] script:
 +    * commit [[https://github.com/servalproject/serval-dna/commit/f948f8e12e0439a239e7362b446fe37e9af3ce40|f948f8e]] added the JNI and MeshMS Java API tests, only run if the JDK is present
 +    * commit [[https://github.com/servalproject/serval-dna/commit/db8ee79a4ee11bc0ddf48e9c451fa813b9844851#diff-7|db8ee79]] added the new Rhizome Java API test script
 +    * commit [[https://github.com/servalproject/serval-dna/commit/c5d3069d823f52494ed5095529ab60fbdab0a8fd|c5d3069]] ensured that the JNI API library is always built by the ''make all'' command
 +
 +The test code coverage for the new C source code created by this contract exceeds the average:
 +
 +^                        ^ Lines                ^^ Functions          ^^
 +| ''http_server.c''      |    70% |     927/1325 |  95.5% |      64/67 |
 +| ''meshms_restful.c''      89% |      316/355 |   100% |      21/21 |
 +| ''rhizome_restful.c''  |    82% |      410/500 |   100% |      24/24 |
 +^ Average for all Serval DNA source code                           ^^^^^
 +| ''*.c *.h''            |  72.2% |  17904/24796 |  81.9% |  1516/1851 |
 +
 +There are no code coverage statistics for the Java source code.
 +
 +**[[#R15]]** -- upgrade Serval Mesh app for Android (completed 25 June 2014)
 +
 +  * The [[:content:servalmesh:|Serval Mesh app for Android]] was improved to use the Java APIs:
 +    * commit [[https://github.com/servalproject/batphone/commit/73e1a70ba4e343defe8f7fcdc90efe5afb03653e|73e1a70]] caused MeshMS UI to start the daemon on demand and use the Java API developed in **[[#R13]]** to list conversations (**[[#R9]]**) and messages (**[[#R10]]**)
 +    * commit [[https://github.com/servalproject/batphone/commit/8c71c3418f7f97f72a4686d7c0d362cfd0ecaa85|8c71c34]] caused MeshMS UI to use the Java API developed in **[[#R13]]** for sending (**[[#R12]]**) and marking messages as read (**[[#N16]]**)
  
-  The new **[[https://github.com/servalproject/serval-dna/blob/development/tests/meshmsjava|meshmsjava]]** test script contains all tests for the new MeshMS Java API: +**Merge** into mainline development branch (completed 11 July 2014
-    * commit [[https://github.com/servalproject/serval-dna/commit/9cbd7c365cc1a9c1f94ff4503d06b520a4e06f49|9cbd7c3]] added a new test case for "Java API MeshMS list conversations" (**[[#R13]]**+  * commit [[https://github.com/servalproject/serval-dna/commit/606f087dd5fe3cc3a22569ae2050dea447b2d2bf|606f087]] merged all work into the mainline development branch
-    * commit [[https://github.com/servalproject/serval-dna/commit/e9437e9a61ad6248c6ae0084521ffafc51c09b68|e9437e9]] added a new test case for "Java API MeshMS list messages" (**[[#R13]]**)+
  
content/activity/naf4.txt · Last modified: 21/02/2016 22:40 by Andrew Bettison