Project

General

Profile

TestOutputDynamicDsInDynamicProcInvalidHandle.p

Maciej Zieniuk, 05/09/2023 10:19 AM

Download (2.57 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 dsMaster2               as handle    no-undo.
9
define variable dsReturnId              as integer   no-undo.
10
define variable hproc                   as handle    no-undo.
11
define variable ttCustomerItemsReturned as integer   no-undo.
12
define variable ttCustomerItems         as integer   no-undo.
13
define variable ttCustomer              as handle    no-undo.
14
define variable dsOrder                 as handle    no-undo.
15
define variable logicalRsp              as logical   no-undo.
16

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

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

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

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

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

    
57
// @Teardown.
58
HandleFactory:deleteDataObjects().
59

    
60
// This should result in valid handle, but does not
61
run support/dataset/create/dsMaster.p(false, false, false, output dsMaster2).
62
MESSAGE valid-handle(dsMaster2).
63