Project

General

Profile

TestOutputDynamicDsInDynamicProc.p

Vladimir Tsichevski, 05/08/2023 03:41 PM

Download (2.32 KB)

 
1
block-level on error undo, throw.
2

    
3
using Progress.Lang.*.
4
using OpenEdge.Core.Assert from propath.
5
using support.test.HandleFactory from propath.
6

    
7
define variable dsMaster                as handle    no-undo.
8
define variable dsReturnId              as integer   no-undo.
9
define variable hproc                   as handle    no-undo.
10
define variable ttCustomerItemsReturned as integer   no-undo.
11
define variable ttCustomerItems         as integer   no-undo.
12
define variable ttCustomer              as handle    no-undo.
13
define variable dsOrder                 as handle    no-undo.
14
define variable logicalRsp              as logical   no-undo.
15

    
16
define variable ttOrderCustomer         as handle    no-undo.
17
define variable ttInit                  as handle    no-undo.
18
define variable dsInit                  as handle    no-undo.
19
define variable errNums2                as integer   extent 2 no-undo.
20
define variable errMsg2                 as character extent 2 no-undo.
21

    
22
// @Before.
23
session:suppress-warnings = false.
24
run support/dataset/help/io_dynamic_parameters.p persistent set hproc.
25

    
26
// @Setup.
27
//define dataset as dynamic with no pk and get ttCustomer
28
run support/dataset/create/dsMaster.p(false, false, false, output dsMaster).
29
// PassWrongDefinition method implemented as a procedure.
30
Assert:IsTrue(valid-handle (dsMaster)).
31
ttCustomer = dsMaster:get-buffer-handle ('ttCustomer'):table-handle.
32
run support/dataset/create/dsOrder.p(false, false, false, output dsOrder).
33
Assert:IsTrue(valid-handle (dsOrder)).
34
ttOrderCustomer = dsOrder:get-buffer-handle ('ttOrderCustomer'):table-handle.
35

    
36
//@Test.
37
// method public void PassWrongDefinition(  ):
38

    
39
//pass wrong definition dataset-handle by-value
40
create temp-table ttInit.
41
ttInit:add-new-field ("num", "integer").
42
ttInit:temp-table-prepare ('init').
43
create dataset dsInit.
44
dsInit:add-buffer (ttInit).
45
run dsAsOutput in hproc( output dataset-handle dsInit by-value, input 3, output dsReturnId, output ttCustomerItemsReturned ) no-error.
46
assign
47
    errNums2[1] = 5363
48
    errNums2[2] = 9030.
49
    
50
assign
51
    errMsg2[1] = 'The caller~'s temp-table parameter init does not match to the target temp-table ttCustomer. (5363)'
52
    errMsg2[2] = 'try switching temp-table method add-fields-from for create-like. (9030)'.
53
support.test.AssertExt:Errors(errNums2, errMsg2, true).
54

    
55
// @Teardown.
56
HandleFactory:deleteDataObjects().
57