Closes OpenAssetIO#51.
Presently, BAL can only be configured using a JSON library file. This
causes several problems with the authoring of automated tests within
host integrations:
* It is difficult to single-source inputs and expected values without
authoring a JSON file in the test case.
* It requires additional side-car data files to accompany the tests
which may not be desirable.
So add a new setting, `"library_json"`. This allows hosts to query for
the current internal BAL library via `settings()`, and then mutate it
and update BAL via a re-`initialize()`.
The JSON must be passed from/to the manager in serialised form, since
the settings dictionary must be coerced to/from a (C++)
`InfoDictionary`, which is a simple key-value map, rather than an
arbitrarily nested dictionary.
In addition, calculated `"variables"` (e.g. `"bal_library_dir_url"`)
cannot be provided when the library is given as a JSON string, since
they are based on the location of the `library_path`.
If both `library_path` and `library_json` are provided, then
`library_json` takes precedence. This allows a JSON library file to be
provided initially, then the library mutated during test cases.
Recall that the OpenAssetIO `initialize` method can accept partial
settings updates, meaning the manager retains any previous settings that
are not explicitly overridden in the new settings dict. However, this
does not apply to the special `library_json` setting here. This is a bit
of an abuse for convenience. E.g. if we re-initialize with an empty
settings dict, the initialization process falls back to using the
previously-set `library_path` (if available) and resets the library to
match the file.
This compromise is somewhat justified by analogy to current behaviour
when BAL is re-initialised after entities have been published. In this
case the new entities only exist in memory, and are lost when
re-initialising, since the library JSON file is re-read and overwrites
any changes. This is similar to how the `library_json` changes are lost
by default when re-initializing.
Signed-off-by: David Feltell <[email protected]>