ESMF_WebServComponentUTest Program

Variables

Type Attributes Name Initial
character(len=ESMF_MAXSTR) :: argBuffer
character(len=ESMF_MAXSTR) :: cdesc
character(len=ESMF_MAXSTR) :: clientId
character(len=ESMF_MAXSTR) :: cname
character(len=ESMF_MAXSTR) :: failMsg
character(len=ESMF_MAXSTR) :: name
integer :: portNum
integer :: rc
integer :: result = 0
type(ESMF_CplComp) :: cplComp
type(ESMF_GridComp) :: comp1

Source Code

program ESMF_WebServComponentUTest
    
!   ! ESMF Framework module
    use ESMF
    use ESMF_TestMod
    use ESMF_WebServMod
    use ESMF_WebServUserModel
    
    implicit none
    
    ! Local variables
    integer                :: rc
    character(ESMF_MAXSTR) :: cname
    character(ESMF_MAXSTR) :: cdesc
    type(ESMF_GridComp)    :: comp1
    type(ESMF_CplComp)     :: cplComp
    integer                :: portNum
    character(ESMF_MAXSTR) :: clientId
    character(ESMF_MAXSTR) :: argBuffer

    ! local test variables
    character(ESMF_MAXSTR) :: failMsg
    character(ESMF_MAXSTR) :: name
    integer                :: result = 0

#ifdef ESMF_TESTEXHAUSTIVE
#endif


        
!-------------------------------------------------------------------------
!   !
!   !  Quick Test - Setup the Web Services Loop

    call ESMF_TestStart(ESMF_SRCLINE, rc=rc)
    if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
 
    !------------------------------------------------------------------------
    ! Setup data parameters for tests
    cname = "ATM"
    cdesc = "Atmosphere - default context"
    comp1 = ESMF_GridCompCreate(name=cname, rc=rc)  

    call ESMF_UtilGetArg (1, argvalue=argBuffer)
    print *, "Arg 1: ", argBuffer
    read(argBuffer,*) portNum
    print *, "Port Num: ", portNum

    call ESMF_UtilGetArg (2, argvalue=argBuffer)
    print *, "Arg 2: ", argBuffer
    read(argBuffer,*) clientId
    print *, "Client ID: ", clientId

    call ESMF_GridCompSetServices(comp1, &
          userRoutine=ESMF_WebServUserModelRegister, rc=rc)

    print *

    !------------------------------------------------------------------------
    !NEX_disable_UTest
    ! This test added to provide a placeholder when revisiting web services
    ! testing.
    rc = ESMF_SUCCESS
    write(failMsg, *) "Did not return ESMF_SUCCESS"
    write(name, *) "ESMF_WebServicesCplCompLoop Unit Test"

    call ESMF_WebServicesCplCompLoop(cplComp, rc=rc)

    call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
    print *
    !------------------------------------------------------------------------

    !------------------------------------------------------------------------
    !NEX_disable_UTest
    ! Verifing that a ESMF Component Web Service can be registered
    rc = ESMF_SUCCESS
!!    portNum = 27060

    write(failMsg, *) "Did not return ESMF_SUCCESS"
    write(name, *) "Web Services Loop"

    call ESMF_WebServicesLoop(comp1, portNum=portNum, clientId=clientId, rc=rc)

    call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
    print *
    !------------------------------------------------------------------------
 

    call ESMF_TestEnd(ESMF_SRCLINE)

end program ESMF_WebServComponentUTest