diff --git a/examples/jfds.bpmn b/examples/jfds.bpmn
new file mode 100644
index 0000000..7a90f22
--- /dev/null
+++ b/examples/jfds.bpmn
@@ -0,0 +1,85 @@
+
+
+
+
+ Flow1_1772027573278
+
+
+ Flow_1qufhs6
+
+
+
+
+ Flow1_1772027573278
+ Flow2_1772027573278
+
+
+ DataStoreReference_0kann3y
+ Property_0omgjkt
+
+ x = jsonfiledatastore.get("x", 1)
+
+
+
+
+ Flow2_1772027573278
+ Flow_1qufhs6
+
+ DataStoreReference_0wm2yyl
+
+ jsonfiledatastore = {
+ "x": x + 1
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/jfds_test.bpmn b/examples/jfds_test.bpmn
new file mode 100644
index 0000000..a380ffc
--- /dev/null
+++ b/examples/jfds_test.bpmn
@@ -0,0 +1,131 @@
+
+
+
+
+ Flow1_1772201981365
+
+
+ Flow_0k2tuld
+
+
+
+
+ Flow_1cyzbm9
+ Flow2_1772201981365
+
+
+
+ Flow1_1772201981365
+ Flow_1cyzbm9
+
+
+ DataStoreReference_0xnrv41
+ Property_0r4ysh6
+
+ spiff_testFixture = {
+ "pendingTaskStack": [],
+ "expected": {
+ "x": jsonfiledatastore["x"] + 1,
+ }
+}
+
+
+
+ Flow2_1772201981365
+ Flow_0k2tuld
+
+
+ DataStoreReference_199b8wr
+ Property_1taen79
+
+ def runTests(tests):
+ import io
+ import unittest
+
+ suite = unittest.TestSuite()
+ suite.addTests(tests)
+ stream = io.StringIO()
+ result = unittest.TextTestRunner(stream=stream).run(suite)
+
+ return {
+ "testsRun": result.testsRun,
+ "wasSuccessful": result.wasSuccessful(),
+ "output": stream.getvalue(),
+ }
+
+def test():
+ import unittest
+
+ class TestTaskData(unittest.TestCase):
+ def runTest(self):
+ x = jsonfiledatastore["x"]
+ expected = spiff_testFixture["expected"]["x"]
+ self.assertEqual(x, expected)
+
+ return runTests([TestTaskData()])
+
+spiff_testResult = test()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/jsonfiledatastore.json b/examples/jsonfiledatastore.json
new file mode 100644
index 0000000..0d8ba44
--- /dev/null
+++ b/examples/jsonfiledatastore.json
@@ -0,0 +1 @@
+{"x": 46}
\ No newline at end of file
diff --git a/test.py b/test.py
index 466da86..8b4e4c9 100644
--- a/test.py
+++ b/test.py
@@ -3,14 +3,36 @@
# dependencies = [
# "jinja2>=3.1.6",
# "jsonschema>=4.26.0",
-# "spiff-arena-common==0.1.8",
+# "spiff-arena-common==0.1.9",
# "spiffworkflow==3.1.2",
# ]
# ///
+import json
import sys
from spiff_arena_common.coverage import task_coverage
+from spiff_arena_common.data_stores import JSONFileDataStore, JSONFileDataStoreConverter
+from SpiffWorkflow.spiff.serializer.config import SPIFF_CONFIG
+
+class JSONFileDataStoreDelegate:
+ def get(self, bpmn_id, my_task):
+ with open(f"examples/{bpmn_id}.json") as f:
+ data = json.loads(f.read())
+ return data, None
+ def set(self, bpmn_id, my_task, data):
+ with open(f"examples/{bpmn_id}.json", "w") as f:
+ f.write(json.dumps(data))
+ return None
+
+class MyJSONFileDataStoreConverter(JSONFileDataStoreConverter):
+ def from_dict(self, dct):
+ ds = super().from_dict(dct)
+ ds.delegate = JSONFileDataStoreDelegate()
+ return ds
+
+SPIFF_CONFIG[JSONFileDataStore] = MyJSONFileDataStoreConverter
+
from spiff_arena_common.tester import run_tests_in_dir
if __name__ == "__main__":