Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Test buildserver, buildclient and buildtms - client
0003  *  This will run with default switch.
0004  *  - tms will be built with TestSw
0005  *  - atmisv71 will be built with TestSw too.
0006  *
0007  * @file atmiclt71_2.c
0008  */
0009 /* -----------------------------------------------------------------------------
0010  * Enduro/X Middleware Platform for Distributed Transaction Processing
0011  * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0012  * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0013  * This software is released under one of the following licenses:
0014  * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0015  * See LICENSE file for full text.
0016  * -----------------------------------------------------------------------------
0017  * AGPL license:
0018  * 
0019  * This program is free software; you can redistribute it and/or modify it under
0020  * the terms of the GNU Affero General Public License, version 3 as published
0021  * by the Free Software Foundation;
0022  *
0023  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0024  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0025  * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0026  * for more details.
0027  *
0028  * You should have received a copy of the GNU Affero General Public License along 
0029  * with this program; if not, write to the Free Software Foundation, Inc., 
0030  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0031  *
0032  * -----------------------------------------------------------------------------
0033  * A commercial use license is available from Mavimax, Ltd
0034  * contact@mavimax.com
0035  * -----------------------------------------------------------------------------
0036  */
0037 #include <string.h>
0038 #include <stdio.h>
0039 #include <stdlib.h>
0040 #include <memory.h>
0041 #include <math.h>
0042 
0043 #include <atmi.h>
0044 #include <ubf.h>
0045 #include <ndebug.h>
0046 #include <test.fd.h>
0047 #include <ndrstandard.h>
0048 #include <nstopwatch.h>
0049 #include <fcntl.h>
0050 #include <unistd.h>
0051 #include <nstdutil.h>
0052 #include "test71.h"
0053 
0054 #ifdef __cplusplus
0055 extern "C"
0056 {
0057 #endif
0058 
0059 /*---------------------------Externs------------------------------------*/
0060 /*---------------------------Macros-------------------------------------*/
0061 /*---------------------------Enums--------------------------------------*/
0062 /*---------------------------Typedefs-----------------------------------*/
0063 /*---------------------------Globals------------------------------------*/
0064 /*---------------------------Statics------------------------------------*/
0065 /*---------------------------Prototypes---------------------------------*/
0066 
0067 /**
0068  * Do the test call to the server
0069  */
0070 int run_echo_services(int argc, char** argv)
0071 {
0072     UBFH *p_ub = (UBFH *)tpalloc("UBF", NULL, 56000);
0073     char *echoservices[] = {"Z", "ECHOSV", "FI1", "FI2", "ECHO2SV", NULL};
0074     long rsplen;
0075     long i, j;
0076     int ret=EXSUCCEED;
0077     
0078     /***************************************************************************/
0079     NDRX_LOG(log_debug, "Check echo service...");
0080     /***************************************************************************/
0081     
0082     for (j=0; NULL!=echoservices[j]; j++)
0083     {
0084         for (i=0; i<1000; i++)
0085         {
0086             long testval;
0087             if (EXFAIL==CBchg(p_ub, T_STRING_FLD, 0, (char *)&i, 0, BFLD_LONG))
0088             {
0089                 NDRX_LOG(log_debug, "Failed to set T_STRING_FLD[0]: %s", Bstrerror(Berror));
0090                 ret=EXFAIL;
0091                 goto out;
0092             }
0093 
0094             if (EXFAIL == tpcall(echoservices[j], (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0))
0095             {
0096                 NDRX_LOG(log_error, "%s failed: %s", echoservices[j], tpstrerror(tperrno));
0097                 ret=EXFAIL;
0098                 goto out;
0099             }
0100             
0101             /* get value back.. */
0102             if (EXFAIL==CBget(p_ub, T_STRING_2_FLD, 0, (char *)&testval, 0, BFLD_LONG))
0103             {
0104                 NDRX_LOG(log_debug, "Failed to set T_STRING_2_FLD[0]: %s", Bstrerror(Berror));
0105                 ret=EXFAIL;
0106                 goto out;
0107             }
0108             
0109             if (i!=testval)
0110             {
0111                 NDRX_LOG(log_error, "TESTERROR echosvc: %s fail %ld vs %ld", 
0112                         echoservices[j], i, testval);
0113             }
0114             
0115         }
0116     }
0117     
0118 out:
0119 
0120     return ret;
0121 }
0122 
0123 #ifdef __cplusplus
0124 } // extern "C"
0125 #endif
0126 
0127 /* vim: set ts=4 sw=4 et smartindent: */