!******************************************************************************!
! Test combining json files in support of CONVERT BLUE2JSON
!
! NXM-3855 Support BLUE information being put in nested JSON text file
!
! Author:  Zachary Matthews
!******************************************************************************!
startmacro

  res cone5000JSON    "cone5000_json.txt"
  res ellipse5000JSON "ellipse5000_json.txt"
  res test1000JSON    "test1000_json.txt"
  res combinedJSON    "combined_json.txt"

  convert cone5000    BLUE2JSON cone5000JSON
  convert ellipse5000 BLUE2JSON ellipse5000JSON
  convert test1000    BLUE2JSON test1000JSON

  new java.lang.String[] array {"^{cone5000JSON}","^{ellipse5000JSON}","^{test1000JSON}"}
  invoke nxm.sys.lib.JsonUtilities.combineJSON("^{combinedJSON}",array)

endmacro


!******************************************************************************!
! Main process message for this macro. Should be right after the ENDMACRO.
!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop
  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

!******************************************************************************!
! If an unexpected exception is caught, mark test as failed, unless it is expected
!******************************************************************************!
procedure processException m:emsg
res emsg.data.message
  if expectedException REXISTS then
    assert/text="^reg.main.name: Expected ERROR starts with: ^{expectedException}" expectedException EQSS emsg.data.message
    remove expectedException
  else
    assert/text="^reg.main.name: Caught unexpected exception ^{emsg.data}" "FALSE" isTrue
    if "Trace" SUBS ENV.DEBUG then invoke ,, emsg.data.printStackTrace()
  endif
return