!******************************************************************************!
!  Macro for testing warning message for Bug 1974 when overwriting
!  non-BLUE and extensionless BLUE files from DataFile class.
!
!  @author: Neon Ngo
!  @bug     1974 (DR 524289-3)
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE  ! for defects or more obscure test case(s)

  call setDatDir

  if interAct then
    res instructions "See instructions about which warning messages should be printed in SHELL."
    pipe on
      panel/msgid=main/controls=gc/setup
      gcontrol label macro "MACRO"
        gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
        set gc.main.itemColors {PASS=GREEN,FAIL=RED}
        gcontrol text idtext "Instructions" "^instructions" 24 12 /title

      shellgui/id=idshellgui/attach

      ! create extensionless temp file for test case
      invoke noextfile java.io.File.createTempFile("noext","")

      ! 1. test warning message for overwriting non-BLUE file
      say "Should see a WARNING for overwriting a non-BLUE file below"
      say "nM> noop ^{datDir}.testxy3000.prm ^noextfile"
      noop ^{datDir}.testxy3000.prm ^noextfile

      say ""
      say ""
      ! 2. test warning message for overwriting an extensionless BLUE file (depends #1 succeeding)
      say "Should see a WARNING for overwriting an extensionless BLUE file below"
      say "nM> noop ^{datDir}.testxy3000.prm ^noextfile"
      noop ^{datDir}.testxy3000.prm ^noextfile

    pipe off

    ! cleanup
    erase/quiet ^noextfile
  endif
endmacro

!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "MAIN"
    assert/text="^reg.main.name: user indicated" msg.data eqss "PASS"
    pipe stop
  endif
return

!******************************************************************************!
! Set the dat directory
!******************************************************************************!
procedure setDatDir
  invoke nxmMajor env.nmversion.subString(0,1)
  invoke major java.lang.Integer.valueOf(nxmMajor)
  if major GE 4 then
    invoke s:datDir           nxm.sys.test.DatLocator.getDatDirLocation()
    invoke s:datDirSlash      nxm.sys.test.DatLocator.getDatDirSlashLocation()
    invoke z:sysDatFull       nxm.sys.test.DatLocator.sysDatFull()
    invoke z:sysTestDatExists nxm.sys.test.DatLocator.sysTestDatExists()
  else
    set s:datDir           "nxm.sys.dat"
    set s:datDirSlash      "nxm/sys/dat"
    set z:sysDatFull       true
    set z:sysTestDatExists false
  endif
return
