Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-DIAG-053

Served include files are watched and redraw their diagrams

When the host serves an include file, or refuses one that does not exist inside the allowed folders, it SHALL remember the canonical path of that file and, when the file changes on disk, tell the page with previewPlantUmlIncludesChanged so that the diagrams that read files are drawn again.

Step 2 of path 1 in StRS-MDOKFSTUDIO-DIAG-009: from “The assembled picture is drawn” to “The diagram is drawn again with the new file text”.

Part of StRS-MDOKFSTUDIO-DIAG-006, outside the paths drawn on its map.

Scenarios 8

The situations the tests check; open one to read it.

nominalServed file and missing file are remembered
Givenan include request that the host serves, and an include of a file that does not exist inside the allowed folders
Whenthe host answers
Thenthe canonical path of the served file, and the candidate path of the missing one, are in the include watch
refusalOutside the folders
Givenan include request for a path outside the allowed folders
Whenthe host refuses it
Thennothing is remembered for it
refusalThe engine is not the built-in one, or the file id is not the host's
Givena previewPlantUmlInclude request
Whenthe Java engine is selected (useJar on, trusted or not), or the request names a `from` that the host never gave in an answer of this document
Thenthe host answers ok false and reads no file; a `from` of null (the document itself) and a `from` the host issued are served as before
nominalA changed file tells the page
Givenan include file remembered by the watch
Whenit changes on disk
Thenthe page receives previewPlantUmlIncludesChanged and draws the diagrams that read files again
boundaryEditor open
Givenan open block editor
Whenan included file changes
Thenthe message is sent after the editor closes (see SwRS-MDOKFSTUDIO-BLOCK-041)
boundaryShape of previewPlantUmlIncludesChanged
InputOutcome
{ type: previewPlantUmlIncludesChanged, documentId } for the document the page showsaccepted; it carries no other field and the page draws again
The same type naming another document, or any other value that is not a registered host messagenot handled by the page (see SwRS-MDOKFSTUDIO-TRUST-059, addressing by document)
nominalOnly diagrams that read files are drawn again
Givena diagram that includes a file and a diagram that includes none
the diagram without includes
Whenthe includes-changed event reaches the page
the same event arrives
Thenthe first diagram asks the host again and is drawn with the new file text, and the kept results that read files are forgotten
it keeps its picture and its kept result
boundaryThe include watch is bounded and cleared
InputOutcome
1025 remembered files, the last one just rememberedthe set holds 1024 and the first is gone
An old file remembered again when the limit is exceededan older untouched file is forgotten first (the set never exceeds 1024)
An include whose parent id was dropped from the 1024 issued idsrefused as an unissued id
The preview follows another documentthe include watch and the issued file ids are empty, so a file remembered for the earlier document that changes afterwards does not tell the page

Implemented in 5

Tested by 4

Known limits (1)

Replaces

SwRS-MDOKFSTUDIO-DIAG-045A changed included file redraws the diagrams that read files superseded superseded by SwRS-MDOKFSTUDIO-DIAG-053 Markdown file
SwRS-MDOKFSTUDIO-DIAG-065A changed include file tells the page superseded superseded by SwRS-MDOKFSTUDIO-DIAG-053 Markdown file
SwRS-MDOKFSTUDIO-DIAG-066The include watch holds at most 1024 files superseded superseded by SwRS-MDOKFSTUDIO-DIAG-053 Markdown file
SwRS-MDOKFSTUDIO-DIAG-067The include watch is cleared when the preview follows another document superseded superseded by SwRS-MDOKFSTUDIO-DIAG-053 Markdown file