project BLF > class tLogger > method FinishUnitTest


Parameters


iiDebugLevelinputinteger
iiSessionUIDinputinteger


Internal usage


BLF
method Session.SetDebugLevel


program code (program1/tlogger.p)

if vcLogUnitTestFile = ""
then return.

/* Analyze current process */
/* Do not report an error on currently running instance of session. */
viLogUnitTestIgnoreSessionUID = iiSessionUID.
<M-1 run LogUnitTest  () in tLogger>
viLogUnitTestIgnoreSessionUID = 0.

viLoggerDebugLevel = iiDebugLevel.

empty temp-table tCompList.

input stream sin from value(vcLogUTIntermediateFile) no-echo.

repeat:
    assign vcOperation = ""
           viNumber    = 0
           vcBC        = "".
    import stream sin vcOperation viNumber vcBC.
    
    case vcOperation :
        when "ACTIVATE"
        then viCSCount = viCSCount + 1.
        when "PROCEDURE"
        then do:
            if not can-find (first tCompList where
                                   tCompList.tcCompName = vcBC and
                                   tCompList.tiCount    = -1)
            then do:
                create tCompList.
                assign tCompList.tcCompName = vcBC
                       tCompList.tiCount    = -1.
            end.
        end.
        when "CREATE"
        then do:
            create tCompList.
            assign tCompList.tcCompName = vcBC
                   tCompList.tiCount    = viNumber.
        end.
        when "DELETE"
        then do:
            find first tCompList where tCompList.tiCount = viNumber no-error.
            if available tCompList
            then delete tCompList.
        end.
        when "READ" or when "READ-WI"
        then do:
            if  vcBC <> ""
            and can-find (tExceptionList where tExceptionList.tcCompName = vcBC)
            then next.
            assign viReadCount = viReadCount + 1
                   viReadTotal = viReadTotal + viNumber.
            if  vcBC <> ""
            and viNumber > viReadHWM
            then assign viReadHWM      = viNumber
                        vcReadHWMQuery = vcBC.
            if  vcOperation = "READ-WI"
            and vcBC <> ""
            and not can-find (first tQueries where tQueries.tcQueryName = vcBC)
            then do:
                create tQueries.
                assign tQueries.tcQueryName = vcBC.
            end.
        end.
    end case.
end.

input stream sin close.


output stream sLug to value (vcLogUnitTestFile) append.

for each tCompList where tCompList.tiCount > 0:
    put stream sLug unformatted
        "Error : instance "
        tCompList.tiCount " of "
        tCompList.tcCompName " is not deleted." skip.
end.

put stream sLug unformatted
    "" skip(2)
    "Whole-index queries" skip
    "____________________" skip.
    
if can-find (first tQueries)
then for each tQueries by tQueries.tcQueryName:
    put stream sLug unformatted tQueries.tcQueryName skip.
end.
else put stream sLug unformatted "none".

put stream sLug unformatted
    "" skip(2)
    "persistent procedure list" skip
    "_________________________" skip.

for each tCompList where tCompList.tiCount < 0 by tCompList.tcCompName:
    if can-find (tExceptionList where tExceptionList.tcCompName = tCompList.tcCompName) then next.
    put stream sLug unformatted tCompList.tcCompName skip.
end.

put stream sLug unformatted
    "" skip(2)
    "Number of server calls = " viCSCount skip
    "Total number of database reads = " viReadCount skip
    "Total number of records read = " viReadTotal skip
    "High water mark = " viReadHWM " for query " vcReadHWMQuery skip(1)
    "Unit test end  " now skip
    fill("_",45) skip.

output stream sLug close.

empty temp-table tCompList.