OK, this is complicated. I wrote some code to create the new JobStateWrappers when restoring the session, and with this code in place, the tests can actually be run from a restored session.
But then I ran into a second problem. When trying to generate the report, we need to access each JobState's "job" property, which should point to an existing JobDefinition over dBus. However, since the restored session also contains "copies" of job definitions, the 'job's actually point to these "restored" copies (which exist in memory as native objects), rather than to the known-over-dbus job definitions.
I tried the approach I used for the local job problem, where I simply create new JobDefinitionWrappers for these, but since the resulting object has the same DBus name as the existing ones (as given by the job's checksum), publishing it over DBus fails for obvious reasons.
I also tried taking the old session's job definitions prior to restoring it, then replacing each job (for each item in the native job_state_map) with its old equivalent, which should point to the already-known job and solve things. The problem here is that a JobState's "job" property is not writable, so this approach again failed. Plus I'm not too happy with this solution which seems kludgy.
Anyway, this needs some more thinking, I'll submit the proposed merge request so you can see where my ideas were going but it's still not working' it gets a bit farther in the running process but fails when trying to get the results.
OK, this is complicated. I wrote some code to create the new JobStateWrappers when restoring the session, and with this code in place, the tests can actually be run from a restored session.
But then I ran into a second problem. When trying to generate the report, we need to access each JobState's "job" property, which should point to an existing JobDefinition over dBus. However, since the restored session also contains "copies" of job definitions, the 'job's actually point to these "restored" copies (which exist in memory as native objects), rather than to the known-over-dbus job definitions.
I tried the approach I used for the local job problem, where I simply create new JobDefinitionWr appers for these, but since the resulting object has the same DBus name as the existing ones (as given by the job's checksum), publishing it over DBus fails for obvious reasons.
I also tried taking the old session's job definitions prior to restoring it, then replacing each job (for each item in the native job_state_map) with its old equivalent, which should point to the already-known job and solve things. The problem here is that a JobState's "job" property is not writable, so this approach again failed. Plus I'm not too happy with this solution which seems kludgy.
Anyway, this needs some more thinking, I'll submit the proposed merge request so you can see where my ideas were going but it's still not working' it gets a bit farther in the running process but fails when trying to get the results.