// // Purpose: openEHR Platform Conformance Test Case // Identifier: tc_ehr-create // Description: Composition operations - create / update / delete. // Interface: I_EHR_COMPOSITION // Copyright: openEHR Foundation (c) 2017 // License: CC-BY-SA 3.0 Unported // Reference: // // Get handle to service and an authorisation token I_EHR_SERVICE ehr_svc; I_EHR_COMPOSITION comp_svc; UUID an_ehr_id = ehr_svc.create_ehr (); PARTY_REF a_subject_id = new party_ref ("ehr", "PERSON", "5555"); UPDATE_AUDIT an_audit = new update_audit ("openehr::249|creation|", "create_composition test", a_subject_id); // ----------- PASS ------------ COMPOSITION new_comp = ehr_svc.create_test_composition (...); UV_COMPOSITION a_comp = new uv_composition (new_comp, an_audit, "openehr::532|complete|"); UUID a_comp_id = comp_svc.create_composition (an_ehr_id, a_comp); assert (not ehr_svc.last_error()); assert (comp_svc.has_composition (an_ehr_id, a_comp_id)); // ----------- FAIL: composition_archetype_invalid ------------ COMPOSITION bad_comp = create_invalid_test_composition (...); UV_COMPOSITION a_comp = new uv_composition (bad_comp, an_audit, "openehr::532|complete|"); UUID a_comp_id = comp_svc.create_composition(an_ehr_id, a_comp); assert (ehr_svc.last_error()); assert (ehr_svc.last_error_call_status.code = EHR_CALL_SATUSES.composition_archetype_invalid);