@@ -635,6 +635,107 @@ TEST_F(CuttingToolTest, test_extended_cutting_item)
635635 sdoc);
636636}
637637
638+ TEST_F (CuttingToolTest, test_extended_cutting_tool_with_json_v2)
639+ {
640+ const auto doc =
641+ R"DOC( <CuttingTool assetId="123456.10" serialNumber="10" toolId="123456">
642+ <CuttingToolLifeCycle>
643+ <CutterStatus>
644+ <Status>AVAILABLE</Status>
645+ </CutterStatus>
646+ <ProgramToolNumber>10</ProgramToolNumber>
647+ <Location negativeOverlap="0" positiveOverlap="0" type="POT">13</Location>
648+ <CuttingItems count="12">
649+ <CuttingItem indices="1">
650+ <ItemLife countDirection="UP" initial="0" limit="0" type="PART_COUNT">0</ItemLife>
651+ <ItemLife countDirection="UP" initial="0" limit="0" type="MINUTES">0</ItemLife>
652+ <ItemLife countDirection="UP" initial="0" limit="0" type="WEAR">0</ItemLife>
653+ <x:ItemCutterStatus xmlns:x="okuma.com:OkumaToolAssets">
654+ <Status>AVAILABLE</Status>
655+ </x:ItemCutterStatus>
656+ <x:ItemProgramToolGroup xmlns:x="okuma.com:OkumaToolAssets">0</x:ItemProgramToolGroup>
657+ </CuttingItem>
658+ </CuttingItems>
659+ </CuttingToolLifeCycle>
660+ </CuttingTool>
661+ )DOC" ;
662+
663+ ErrorList errors;
664+ entity::XmlParser parser;
665+
666+ auto entity = parser.parse (Asset::getRoot (), doc, errors);
667+ ASSERT_EQ (0 , errors.size ());
668+
669+ auto asset = dynamic_cast <Asset *>(entity.get ());
670+ ASSERT_NE (nullptr , asset);
671+
672+ entity::JsonEntityPrinter jprinter (2 , true );
673+ auto jdoc = jprinter.print (entity);
674+
675+ EXPECT_EQ (R"( {
676+ "CuttingTool": {
677+ "CuttingToolLifeCycle": {
678+ "CutterStatus": {
679+ "Status": [
680+ {
681+ "value": "AVAILABLE"
682+ }
683+ ]
684+ },
685+ "CuttingItems": {
686+ "CuttingItem": [
687+ {
688+ "ItemLife": [
689+ {
690+ "value": 0.0,
691+ "countDirection": "UP",
692+ "initial": 0.0,
693+ "limit": 0.0,
694+ "type": "PART_COUNT"
695+ },
696+ {
697+ "value": 0.0,
698+ "countDirection": "UP",
699+ "initial": 0.0,
700+ "limit": 0.0,
701+ "type": "MINUTES"
702+ },
703+ {
704+ "value": 0.0,
705+ "countDirection": "UP",
706+ "initial": 0.0,
707+ "limit": 0.0,
708+ "type": "WEAR"
709+ }
710+ ],
711+ "indices": "1",
712+ "x:ItemCutterStatus": {
713+ "Status": "AVAILABLE",
714+ "xmlns:x": "okuma.com:OkumaToolAssets"
715+ },
716+ "x:ItemProgramToolGroup": {
717+ "value": "0",
718+ "xmlns:x": "okuma.com:OkumaToolAssets"
719+ }
720+ }
721+ ],
722+ "count": 12
723+ },
724+ "Location": {
725+ "value": "13",
726+ "negativeOverlap": 0,
727+ "positiveOverlap": 0,
728+ "type": "POT"
729+ },
730+ "ProgramToolNumber": "10"
731+ },
732+ "assetId": "123456.10",
733+ "serialNumber": "10",
734+ "toolId": "123456"
735+ }
736+ })" , jdoc);
737+ }
738+
638739TEST_F (CuttingToolTest, test_xmlns_with_top_element_alias)
639740{
640741 const auto doc =
0 commit comments