Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief @(#) Test021 - XA testing
0004 ##
0005 ## @file cli-tests.sh
0006 ##
0007 ## -----------------------------------------------------------------------------
0008 ## Enduro/X Middleware Platform for Distributed Transaction Processing
0009 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0010 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0011 ## This software is released under one of the following licenses:
0012 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0013 ## See LICENSE file for full text.
0014 ## -----------------------------------------------------------------------------
0015 ## AGPL license:
0016 ##
0017 ## This program is free software; you can redistribute it and/or modify it under
0018 ## the terms of the GNU Affero General Public License, version 3 as published
0019 ## by the Free Software Foundation;
0020 ##
0021 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY
0022 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0023 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0024 ## for more details.
0025 ##
0026 ## You should have received a copy of the GNU Affero General Public License along 
0027 ## with this program; if not, write to the Free Software Foundation, Inc.,
0028 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0029 ##
0030 ## -----------------------------------------------------------------------------
0031 ## A commercial use license is available from Mavimax, Ltd
0032 ## contact@mavimax.com
0033 ## -----------------------------------------------------------------------------
0034 ##
0035 
0036 IFS=$'\n'
0037 
0038 # Include test functions
0039 source ./test-func-include.sh
0040 
0041 echo "Cli tests..."
0042 (./atmiclt21-cli 2>&1) > ./atmiclt21-cli-dom1.log || exit 1
0043 
0044 # Should print 100x transactions:
0045 ensure_tran 100
0046 
0047 ###############################################################################
0048 # Now abort all trans...
0049 ###############################################################################
0050 REFS=`xadmin pt | grep 'TM ref' | cut -d ':' -f2 | cut -d ')' -f1`
0051 for t in $REFS
0052 do
0053         cmd="xadmin abort $t -y" 
0054         echo "Running [$cmd"]
0055         eval $cmd
0056 done
0057 ###############################################################################
0058 # Now do commit tests, will fail because we are not  in PREPARE tx stage
0059 ###############################################################################
0060 (./atmiclt21-cli 2>&1) > ./atmiclt21-cli-dom1.log || exit 1
0061 REFS=`xadmin pt | grep 'TM ref' | cut -d ':' -f2 | cut -d ')' -f1`
0062 
0063 for t in $REFS
0064 do
0065         cmd="xadmin commit $t -y" 
0066         echo "Running [$cmd"]
0067         eval $cmd
0068 done
0069 
0070 ensure_tran 100
0071 
0072 ###############################################################################
0073 # Finish them off
0074 ###############################################################################
0075 REFS=`xadmin pt | grep 'TM ref' | cut -d ':' -f2 | cut -d ')' -f1`
0076 for t in $REFS
0077 do
0078         cmd="xadmin abort $t -y" 
0079         echo "Running [$cmd"]
0080         eval $cmd
0081 done
0082 ###############################################################################
0083 ensure_tran 0
0084 
0085 # vim: set ts=4 sw=4 et smartindent: