Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const {zcl_abapgit_xml} = await import("./zcl_abapgit_xml.clas.mjs");
const {zcl_abapgit_xml_output} = await import("./zcl_abapgit_xml_output.clas.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_xml_output.clas.testclasses.abap
class ltcl_xml_output {
static STATIC_SUPER = undefined;
static INTERNAL_TYPE = 'CLAS';
static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_XML_OUTPUT-LTCL_XML_OUTPUT';
static IMPLEMENTED_INTERFACES = [];
static ATTRIBUTES = {};
static METHODS = {"RENDER_XML_STRING": {"visibility": "U", "parameters": {}},
"ADD_SIMPLE_OBJECT": {"visibility": "U", "parameters": {}}};
constructor() {
this.me = new abap.types.ABAPObject();
this.me.set(this);
this.INTERNAL_ID = abap.internalIdCounter++;
this.FRIENDS_ACCESS_INSTANCE = {
"render_xml_string": this.render_xml_string.bind(this),
"add_simple_object": this.add_simple_object.bind(this),
};
}
async constructor_(INPUT) {
if (super.constructor_) { await super.constructor_(INPUT); }
return this;
}
async add_simple_object() {
let ls_input = new abap.types.Structure({
"foo": new abap.types.Integer({qualifiedName: "LTCL_XML_OUTPUT=>TY_OLD-FOO"}),
"bar": new abap.types.Character(1, {"qualifiedName":"ltcl_xml_output=>ty_old-bar"})}, "ltcl_xml_output=>ty_old", undefined, {}, {});
let ls_result = new abap.types.Structure({
"foo": new abap.types.Integer({qualifiedName: "LTCL_XML_OUTPUT=>TY_OLD-FOO"}),
"bar": new abap.types.Character(1, {"qualifiedName":"ltcl_xml_output=>ty_old-bar"})}, "ltcl_xml_output=>ty_old", undefined, {}, {});
let lv_value = new abap.types.String({qualifiedName: "STRING"});
let li_xml_element = new abap.types.ABAPObject({qualifiedName: "IF_IXML_ELEMENT", RTTIName: "\\INTERFACE=IF_IXML_ELEMENT"});
let lo_output = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_XML_OUTPUT", RTTIName: "\\CLASS=ZCL_ABAPGIT_XML_OUTPUT"});
ls_input.get().foo.set(abap.CharacterFactory.get(1, '2'));
ls_input.get().bar.set(abap.CharacterFactory.get(1, 'A'));
lo_output.set(await (new abap.Classes['ZCL_ABAPGIT_XML_OUTPUT']()).constructor_());
await lo_output.get().zif_abapgit_xml_output$add({iv_name: abap.CharacterFactory.get(4, 'DATA'), ig_data: ls_input});
li_xml_element.set((await lo_output.get().mi_xml_doc.get().if_ixml_document$find_from_name({name: abap.CharacterFactory.get(3, 'FOO')})));
lv_value.set((await li_xml_element.get().if_ixml_element$get_value()));
ls_result.get().foo.set(lv_value);
li_xml_element.set((await lo_output.get().mi_xml_doc.get().if_ixml_document$find_from_name({name: abap.CharacterFactory.get(3, 'BAR')})));
lv_value.set((await li_xml_element.get().if_ixml_element$get_value()));
ls_result.get().bar.set(lv_value);
await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: ls_input, exp: ls_result});
}
async render_xml_string() {
let ls_input = new abap.types.Structure({
"foo": new abap.types.Integer({qualifiedName: "LTCL_XML_OUTPUT=>TY_OLD-FOO"}),
"bar": new abap.types.Character(1, {"qualifiedName":"ltcl_xml_output=>ty_old-bar"})}, "ltcl_xml_output=>ty_old", undefined, {}, {});
let lv_expected = new abap.types.String({qualifiedName: "STRING"});
let lv_xml = new abap.types.String({qualifiedName: "STRING"});
let lo_output = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_XML_OUTPUT", RTTIName: "\\CLASS=ZCL_ABAPGIT_XML_OUTPUT"});
let lo_conv_in_string = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_CONV_IN_CE", RTTIName: "\\CLASS=CL_ABAP_CONV_IN_CE"});
let lo_conv_out_string = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_CONV_OUT_CE", RTTIName: "\\CLASS=CL_ABAP_CONV_OUT_CE"});
let lv_encoding = new abap.types.Character(20, {"qualifiedName":"abap_encoding"});
let lv_xstring = new abap.types.XString({qualifiedName: "XSTRING"});
let lv_bom = new abap.types.XString({qualifiedName: "XSTRING"});
ls_input.get().foo.set(abap.CharacterFactory.get(1, '2'));
ls_input.get().bar.set(abap.CharacterFactory.get(1, 'A'));
lv_expected.set(abap.operators.concat([abap.CharacterFactory.get(67, '<?xml version="1.0" encoding="utf-16"?>#<abapGit version="v1.0.0">#'),abap.CharacterFactory.get(65, ' <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">#'),abap.CharacterFactory.get(52, ' <asx:values># <DATA># <FOO>2</FOO># <BAR>A'),abap.CharacterFactory.get(58, '</BAR># </DATA># </asx:values># </asx:abap>#</abapGit>#')]));
abap.statements.replace({target: lv_expected, all: true, with: abap.Classes['CL_ABAP_CHAR_UTILITIES'].newline, of: abap.CharacterFactory.get(1, '#')});
lo_output.set(await (new abap.Classes['ZCL_ABAPGIT_XML_OUTPUT']()).constructor_());
await lo_output.get().zif_abapgit_xml_output$add({iv_name: abap.CharacterFactory.get(4, 'DATA'), ig_data: ls_input});
lv_xml.set((await lo_output.get().zif_abapgit_xml_output$render()));
lv_encoding.set((await abap.Classes['CL_ABAP_CODEPAGE'].sap_codepage({encoding: new abap.types.String().set(`UTF-16LE`)})));
lo_conv_out_string.set((await abap.Classes['CL_ABAP_CONV_OUT_CE'].create({encoding: lv_encoding, ignore_cerr: abap.CharacterFactory.get(1, 'X')})));
await lo_conv_out_string.get().write({data: lv_expected});
lv_xstring.set((await lo_conv_out_string.get().get_buffer()));
if (abap.compare.gt(abap.Classes['CL_ABAP_CHAR_UTILITIES'].charsize, abap.IntegerFactory.get(1))) {
lv_bom.set(abap.Classes['CL_ABAP_CHAR_UTILITIES'].byte_order_mark_little);
abap.statements.concatenate({source: [lv_bom, lv_xstring], target: lv_xstring});
}
lo_conv_in_string.set((await abap.Classes['CL_ABAP_CONV_IN_CE'].create({encoding: lv_encoding, input: lv_xstring})));
await lo_conv_in_string.get().read({data: lv_expected});
await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_xml, exp: lv_expected});
}
}
abap.Classes['CLAS-ZCL_ABAPGIT_XML_OUTPUT-LTCL_XML_OUTPUT'] = ltcl_xml_output;
ltcl_xml_output.ty_old = new abap.types.Structure({
"foo": new abap.types.Integer({qualifiedName: "LTCL_XML_OUTPUT=>TY_OLD-FOO"}),
"bar": new abap.types.Character(1, {"qualifiedName":"ltcl_xml_output=>ty_old-bar"})}, "ltcl_xml_output=>ty_old", undefined, {}, {});
export {ltcl_xml_output}; |