diff --git a/core/src/test/scala/eu/nomad_lab/parsers/BackendH5Spec.scala b/core/src/test/scala/eu/nomad_lab/parsers/BackendH5Spec.scala index 27900a823298c71ce32e0f4dc973e470f6a6e29b..ca17b437efb00618d195bf2d3a8fa482f038bd24 100644 --- a/core/src/test/scala/eu/nomad_lab/parsers/BackendH5Spec.scala +++ b/core/src/test/scala/eu/nomad_lab/parsers/BackendH5Spec.scala @@ -57,27 +57,32 @@ object BackendH5Spec extends Specification with StrictLogging { def addChecksumTest() = { val sysUri = "nmd://N0jqPXU7FP2SaaH8sMvXrW0DZsK0Z/CGivpJxhUx8d3FzFw7jHDjE51ZlOK/section_run/section_system/0c" val sysRef = NomadUri(sysUri).toRef - backend.openContext(sysRef) - backend.addValue("configuration_raw_gid", jn.JString("pippo_pippo")) - backend.closeContext(sysRef) - val calcRef = NomadUri("nmd://N0jqPXU7FP2SaaH8sMvXrW0DZsK0Z/CGivpJxhUx8d3FzFw7jHDjE51ZlOK").toRef - backend.openContext(calcRef) + val calcRef = NomadUri("nmd://N0jqPXU7FP2SaaH8sMvXrW0DZsK0Z/CGivpJxhUx8d3FzFw7jHDjE51ZlOK").toRef match { + case c: CalculationRef => c + case _ => throw new Exception("expected a calculationRef") + } + backend.openCalculation(calcRef) backend.startedParsingSession( mainFileUri = None, parserInfo = jn.JObject( ("parserId" -> jn.JString("testParser")) :: Nil ) ) + backend.openContext(sysRef) + backend.addValue("configuration_raw_gid", jn.JString("pippo_pippo")) + backend.closeContext(sysRef) + backend.openContext(calcRef) val sstats = backend.openSection("section_stats") val spp = backend.openSection("section_stats_per_parser") backend.addValue("stats_per_parser_parser_id", jn.JString("pippo_pippo_v1")) backend.closeSection("section_stats_per_parser", spp) backend.closeSection("section_stats", sstats) + backend.closeContext(calcRef) backend.finishedParsingSession( parserStatus = Some(ParseResult.ParseSuccess), parserErrors = jn.JNothing ) - backend.closeContext(calcRef) + backend.closeCalculation(calcRef) val confGid = Resolver.resolveInArchiveSet(outArchive, NomadUri(sysUri + "/configuration_raw_gid/0l").toRef) val pid = Resolver.resolveInArchiveSet(outArchive, NomadUri("nmd://N0jqPXU7FP2SaaH8sMvXrW0DZsK0Z/CGivpJxhUx8d3FzFw7jHDjE51ZlOK/section_processor_info/processor_id/0c").toRef) confGid match {