/
atmiclt21-cli.c
113 lines (98 loc) · 3.87 KB
/
atmiclt21-cli.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* @brief XA transaction processing, cli tests (listing & commit & abort)
*
* @file atmiclt21-cli.c
*/
/* -----------------------------------------------------------------------------
* Enduro/X Middleware Platform for Distributed Transaction Processing
* Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
* Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
* This software is released under one of the following licenses:
* AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
* See LICENSE file for full text.
* -----------------------------------------------------------------------------
* AGPL license:
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License, version 3 as published
* by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
* for more details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* -----------------------------------------------------------------------------
* A commercial use license is available from Mavimax, Ltd
* contact@mavimax.com
* -----------------------------------------------------------------------------
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <math.h>
#include <atmi.h>
#include <ubf.h>
#include <ndebug.h>
#include <test.fd.h>
#include <ndrstandard.h>
#include <nstopwatch.h>
/*---------------------------Externs------------------------------------*/
/*---------------------------Macros-------------------------------------*/
/*---------------------------Enums--------------------------------------*/
/*---------------------------Typedefs-----------------------------------*/
/*---------------------------Globals------------------------------------*/
/*---------------------------Statics------------------------------------*/
/*---------------------------Prototypes---------------------------------*/
/*
* Just open the transaction, and let do shell testing later
*/
int main(int argc, char** argv) {
UBFH *p_ub = (UBFH *)tpalloc("UBF", NULL, 9216);
long rsplen;
int i=0;
int ret=EXSUCCEED;
TPTRANID tranid;
if (EXSUCCEED!=tpopen())
{
NDRX_LOG(log_error, "TESTERROR: tpopen() fail: %d:[%s]",
tperrno, tpstrerror(tperrno));
ret=EXFAIL;
goto out;
}
/***************************************************************************/
NDRX_LOG(log_debug, "Just opening a transactions (later will process cli by shell)");
/***************************************************************************/
for (i=0; i<100; i++)
{
if (EXSUCCEED!=tpbegin(60, 0))
{
NDRX_LOG(log_error, "TESTERROR: tpbegin() fail: %d:[%s]",
tperrno, tpstrerror(tperrno));
ret=EXFAIL;
goto out;
}
Bchg(p_ub, T_STRING_FLD, 0, "TEST HELLO WORLD COMMIT", 0L);
/* Call Svc1 */
if (EXFAIL == (ret=tpcall("RUNTX", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0)))
{
NDRX_LOG(log_error, "TX3SVC failed: %s", tpstrerror(tperrno));
ret=EXFAIL;
goto out;
}
/* Suspend off from tran... */
tpsuspend (&tranid, 0);
}
out:
/* So for some reason we do not */
tpclose();
tpterm();
NDRX_LOG(log_error, "Exiting with %d", ret);
return ret;
}
/* vim: set ts=4 sw=4 et smartindent: */