echo "\n"
echo "\n"
echo "Valid cases:"
echo "All options specified except hostname"
echo "wbemexec -p 5988 -v 1.1 -m M-POST -t 10000 -u guest -w guest ./cimrequest.xml"
echo "\n"
wbemexec -p 5988 -v 1.1 -m M-POST -t 10000 -u guest -w guest ./cimrequest.xml
echo "\n"
echo "\n"

echo "All options specified except hostname"
echo "wbemexec -p5988 -v1.1 -mM-POST -t10000 -uguest -wguest ./cimrequest.xml"
echo "\n"
wbemexec -p5988 -v1.1 -mM-POST -t10000 -uguest -wguest ./cimrequest.xml
echo "\n"
echo "\n"

echo "No options specified"
echo "wbemexec < ./cimrequest.xml"
echo "\n"
wbemexec < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Test cases for HTTP version option:"
echo "-v 1.0 option specified"
echo "wbemexec -v 1.0 ./cimrequest.xml"
echo "\n"
wbemexec -v 1.0 ./cimrequest.xml
echo "\n"
echo "\n"

echo "-v 1.1 option specified"
echo "wbemexec -v 1.1 ./cimrequest.xml"
echo "\n"
wbemexec -v 1.1 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Test cases for HTTP method option:"
echo "-m POST option specified"
echo "wbemexec -m POST ./cimrequest.xml"
echo "\n"
wbemexec -m POST ./cimrequest.xml
echo "\n"
echo "\n"

echo "-m M-POST option specified"
echo "wbemexec -m M-POST ./cimrequest.xml"
echo "\n"
wbemexec -m M-POST ./cimrequest.xml
echo "\n"
echo "\n"

echo "-m POST -v 1.0 specified"
echo "wbemexec -v 1.0 -m POST ./cimrequest.xml"
echo "\n"
wbemexec -v 1.0 -m POST ./cimrequest.xml
echo "\n"
echo "\n"

echo "-m POST -v 1.1 specified"
echo "wbemexec -v 1.1 -m POST ./cimrequest.xml"
echo "\n"
wbemexec -v 1.1 -m POST ./cimrequest.xml
echo "\n"
echo "\n"

echo "-m M-POST -v 1.1 specified"
echo "wbemexec -v 1.1 -m M-POST ./cimrequest.xml"
echo "\n"
wbemexec -v 1.1 -m M-POST ./cimrequest.xml
echo "\n"
echo "\n"

echo "Test cases for timeout option:"
echo "minimum valid timeout value (milliseconds)"
echo "wbemexec -t 1 ./cimrequest.xml"
echo "\n"
wbemexec -t 1 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Test cases for timeout option:"
echo "maximum valid timeout value (milliseconds)"
echo "wbemexec -t 4294967295 ./cimrequest.xml"
echo "\n"
wbemexec -t 4294967295 ./cimrequest.xml
echo "\n"
echo "\n"

echo "XML request already encapsulated in HTTP M-POST request"
echo "wbemexec ./cimrequest.http"
echo "\n"
wbemexec ./cimrequest.http
echo "\n"
echo "\n"

echo "Multiple CIM operation request"
echo "Times out -- not yet supported by CIM Server"
echo "wbemexec -t 1 ./cimrequest04.xml"
echo "\n"
wbemexec -t 1 ./cimrequest04.xml
echo "\n"
echo "\n"

echo "Error cases:"
echo "Missing argument for -h option"
echo "wbemexec -h < ./cimrequest.xml"
echo "\n"
wbemexec -h < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Missing argument for -p option"
echo "wbemexec -p < ./cimrequest.xml"
echo "\n"
wbemexec -p < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Missing argument for -v option"
echo "wbemexec -v < ./cimrequest.xml"
echo "\n"
wbemexec -v < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Missing argument for -m option"
echo "wbemexec -m < ./cimrequest.xml"
echo "\n"
wbemexec -m < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Missing argument for -t option"
echo "wbemexec -t < ./cimrequest.xml"
echo "\n"
wbemexec -t < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Missing argument for -u option"
echo "wbemexec -u < ./cimrequest.xml"
echo "\n"
wbemexec -u < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Missing argument for -w option"
echo "wbemexec -w < ./cimrequest.xml"
echo "\n"
wbemexec -w < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Missing argument for -d option"
echo "wbemexec -d < ./cimrequest.xml"
echo "\n"
wbemexec -d < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Non-option argument -"
echo "Works -- getoopt behavior differs from other implementations of getopt"
echo "wbemexec - < ./cimrequest.xml"
echo "\n"
wbemexec - < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Non-option argument -"
echo "Works -- getoopt behavior differs from other implementations of getopt"
echo "wbemexec - ./cimrequest.xml"
echo "\n"
wbemexec - ./cimrequest.xml
echo "\n"
echo "\n"

echo "Empty string non-option argument"
echo "wbemexec \"\" < ./cimrequest.xml"
echo "\n"
wbemexec "" < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Empty string non-option argument"
echo "wbemexec \"\" ./cimrequest.xml"
echo "\n"
wbemexec "" ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid option -x"
echo "wbemexec -x < ./cimrequest.xml"
echo "\n"
wbemexec -x < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid option -x"
echo "wbemexec -u guest -w guest -x < ./cimrequest.xml"
echo "\n"
wbemexec -u guest -w guest -x < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid option -x"
echo "wbemexec -u guest -x -w guest < ./cimrequest.xml"
echo "\n"
wbemexec -u guest -x -w guest < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid option -x"
echo "wbemexec -x foo < ./cimrequest.xml"
echo "\n"
wbemexec -x foo < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid option -x"
echo "wbemexec -xfoo < ./cimrequest.xml"
echo "\n"
wbemexec -xfoo < ./cimrequest.xml
echo "\n"
echo "\n"

echo "Duplicate -h option"
echo "wbemexec -h chacha -h cancan ./cimrequest.xml"
echo "\n"
wbemexec -h chacha -h cancan ./cimrequest.xml
echo "\n"
echo "\n"

echo "Duplicate -p option"
echo "wbemexec -p 5988 -p 81 ./cimrequest.xml"
echo "\n"
wbemexec -p 5988 -p 81 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Duplicate -v option"
echo "wbemexec -v 1.0 -v 1.1 ./cimrequest.xml"
echo "\n"
wbemexec -v 1.0 -v 1.1 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Duplicate -m option"
echo "wbemexec -m POST -m M-POST ./cimrequest.xml"
echo "\n"
wbemexec -m POST -m M-POST ./cimrequest.xml
echo "\n"
echo "\n"

echo "Duplicate -t option"
echo "wbemexec -t 25000 -t 30000 ./cimrequest.xml"
echo "\n"
wbemexec -t 25000 -t 30000 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Duplicate -u option"
echo "wbemexec -u guest -u guest2 ./cimrequest.xml"
echo "\n"
wbemexec -u guest -u guest2 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Duplicate -w option"
echo "wbemexec -w guest -w guest2 ./cimrequest.xml"
echo "\n"
wbemexec -w guest -w guest2 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Multiple inputfilepath arguments"
echo "wbemexec ./cimrequest.xml ./cimrequest2.xml"
echo "\n"
wbemexec ./cimrequest.xml ./cimrequest2.xml
echo "\n"
echo "\n"

echo "Invalid hostName argument"
echo "wbemexec -h nohost ./cimrequest.xml"
echo "\n"
wbemexec -h nohost ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid number format for portNumber argument"
echo "wbemexec -p xxx ./cimrequest.xml"
echo "\n"
wbemexec -p xxx ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid number format for portNumber argument"
echo "wbemexec -p 1.1 ./cimrequest.xml"
echo "\n"
wbemexec -p 1.1 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid number format for portNumber argument"
echo "wbemexec -p 1E+1 ./cimrequest.xml"
echo "\n"
wbemexec -p 1E+1 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Out of range portNumber argument"
echo "getoopt behavior differs from other implementations of getopt:"
echo "getoopt reports missing required value for flag p"
echo "wbemexec -p -5988 ./cimrequest.xml"
echo "\n"
wbemexec -p -5988 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Out of range portNumber argument"
echo "getoopt behavior differs from other implementations of getopt:"
echo "getoopt reports missing required value for flag p"
echo "wbemexec -p -1 ./cimrequest.xml"
echo "\n"
wbemexec -p -1 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Out of range portNumber argument"
echo "wbemexec -p 65536 ./cimrequest.xml"
echo "\n"
wbemexec -p 65536 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Maximum valid portnumber, but cimom not running on specified port"
echo "wbemexec -p 65535 ./cimrequest.xml"
echo "\n"
wbemexec -p 65535 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Minimum valid portnumber, but cimom not running on specified port"
echo "wbemexec -p 0 ./cimrequest.xml"
echo "\n"
wbemexec -p 0 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid (unsupported) version argument"
echo "wbemexec -v 0.9 ./cimrequest.xml"
echo "\n"
wbemexec -v 0.9 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid (unsupported) method argument"
echo "wbemexec -m GET ./cimrequest.xml"
echo "\n"
wbemexec -m GET ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid combination of version and method argument (1.0 with M-POST)"
echo "wbemexec -v 1.0 -m M-POST ./cimrequest.xml"
echo "\n"
wbemexec -v 1.0 -m M-POST ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid number format for timeout argument"
echo "wbemexec -t xxx ./cimrequest.xml"
echo "\n"
wbemexec -t xxx ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid number format for timeout argument"
echo "wbemexec -t 1.1 ./cimrequest.xml"
echo "\n"
wbemexec -t 1.1 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid number format for timeout argument"
echo "wbemexec -t 1e-1 ./cimrequest.xml"
echo "\n"
wbemexec -t 1e-1 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Out of range timeout argument value"
echo "wbemexec -t 0 ./cimrequest.xml"
echo "\n"
wbemexec -t 0 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Out of range timeout argument value"
echo "wbemexec -t 4294967296 ./cimrequest.xml"
echo "\n"
wbemexec -t 4294967296 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid user argument"
echo "Works now because no authentication or authorization"
echo "wbemexec -u nonuser ./cimrequest.xml"
echo "\n"
wbemexec -u nonuser ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid password argument"
echo "Works now because no authentication or authorization"
echo "wbemexec -w nonpassword ./cimrequest.xml"
echo "\n"
wbemexec -w nonpassword ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid debug argument"
echo "wbemexec -d 11 ./cimrequest.xml"
echo "\n"
wbemexec -d 11 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid debug argument"
echo "wbemexec -d 22 ./cimrequest.xml"
echo "\n"
wbemexec -d 22 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid debug argument"
echo "wbemexec -d 3 ./cimrequest.xml"
echo "\n"
wbemexec -d 3 ./cimrequest.xml
echo "\n"
echo "\n"

echo "Invalid inputFilePath argument: file does not exist"
echo "wbemexec ./nonfile"
echo "\n"
wbemexec ./nonfile
echo "\n"
echo "\n"

echo "Invalid inputFilePath argument: file is not readable"
echo "wbemexec ./nopermfile"
echo "\n"
touch ./nopermfile
chmod 000 ./nopermfile
wbemexec ./nopermfile
/bin/rm -f ./nopermfile
echo "\n"
echo "\n"

echo "No input provided"
echo "wbemexec ./emptyfile"
echo "\n"
touch ./emptyfile
wbemexec ./emptyfile
/bin/rm -f ./emptyfile
echo "\n"
echo "\n"

echo "No input provided"
echo "wbemexec < ./emptyfile"
echo "\n"
touch ./emptyfile
wbemexec < ./emptyfile
/bin/rm -f ./emptyfile
echo "\n"
echo "\n"

echo "Invalid XML input: missing <CIM> element (no element)"
echo "wbemexec ./cimreqerr01.xml"
echo "\n"
wbemexec ./cimreqerr01.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <CIM> element (different element)"
echo "wbemexec ./cimreqerr01a.xml"
echo "\n"
wbemexec ./cimreqerr01a.xml
echo "\n"
echo "\n"

echo "Invalid XML input: invalid CIMVERSION attribute"
echo "wbemexec ./cimreqerr01b.xml"
echo "\n"
wbemexec ./cimreqerr01b.xml
echo "\n"
echo "\n"

echo "Invalid XML input: invalid DTDVERSION attribute"
echo "wbemexec ./cimreqerr01c.xml"
echo "\n"
wbemexec ./cimreqerr01c.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing CIMVERSION attribute"
echo "wbemexec ./cimreqerr01d.xml"
echo "\n"
wbemexec ./cimreqerr01d.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing DTDVERSION attribute"
echo "wbemexec ./cimreqerr01e.xml"
echo "\n"
wbemexec ./cimreqerr01e.xml
echo "\n"
echo "\n"


echo "Invalid XML input: missing <MESSAGE> element (no element)"
echo "wbemexec -u guest -w guest < ./cimreqerr02.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr02.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <MESSAGE> element (different element)"
echo "wbemexec -u guest -w guest < ./cimreqerr02a.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr02a.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing PROTOCOLVERSION attribute"
echo "wbemexec -u guest -w guest < ./cimreqerr02b.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr02b.xml
echo "\n"
echo "\n"


echo "Invalid XML input: missing <SIMPLEREQ> element (no element)"
echo "wbemexec -u guest -w guest < ./cimreqerr03.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr03.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <SIMPLEREQ> element (different element)"
echo "wbemexec -u guest -w guest < ./cimreqerr03a.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr03a.xml
echo "\n"
echo "\n"


echo "Invalid XML input: missing <IMETHODCALL> or <METHODCALL> element "
echo "    (no element)"
echo "wbemexec -u guest -w guest < ./cimreqerr04.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr04.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <IMETHODCALL> or <METHODCALL> element "
echo "    (different element)"
echo "wbemexec -u guest -w guest < ./cimreqerr04a.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr04a.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing NAME attribute "
echo "wbemexec -u guest -w guest < ./cimreqerr04b.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr04b.xml
echo "\n"
echo "\n"


echo "Invalid XML input: missing <LOCALNAMESPACEPATH> element (no element)"
echo "wbemexec -u guest -w guest < ./cimreqerr05.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr05.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <LOCALNAMESPACEPATH> element (different "
echo "    element)"
echo "wbemexec -u guest -w guest < ./cimreqerr05a.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr05a.xml
echo "\n"
echo "\n"


echo "Invalid XML input: missing <NAMESPACE> element (no element)"
echo "wbemexec -u guest -w guest < ./cimreqerr06.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr06.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <NAMESPACE> element (different element)"
echo "wbemexec -u guest -w guest < ./cimreqerr06a.xml"
echo "\n"
wbemexec -u guest -w guest < ./cimreqerr06a.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing NAME attribute for NAMESPACE element"
echo "wbemexec ./cimreqerr06b.xml"
echo "\n"
wbemexec ./cimreqerr06b.xml
echo "\n"
echo "\n"

echo "Invalid XML input: subelement other than NAMESPACE in list"
echo "wbemexec ./cimreqerr06c.xml"
echo "\n"
wbemexec ./cimreqerr06c.xml
echo "\n"
echo "\n"

echo "Invalid XML input: subelement other than NAMESPACE in list"
echo "wbemexec ./cimreqerr06d.xml"
echo "\n"
wbemexec ./cimreqerr06d.xml
echo "\n"
echo "\n"


echo "Invalid XML input: missing <LOCALCLASSPATH> or <LOCALINSTANCEPATH> "
echo "    element (no element)"
echo "wbemexec ./cimreqerr07.xml"
echo "\n"
wbemexec ./cimreqerr07.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <LOCALCLASSPATH> or <LOCALINSTANCEPATH> "
echo "    element (different element)"
echo "wbemexec ./cimreqerr07a.xml"
echo "\n"
wbemexec ./cimreqerr07a.xml
echo "\n"
echo "\n"


echo "Invalid XML input: missing <LOCALNAMESPACEPATH> element (no element)"
echo "wbemexec ./cimreqerr08.xml"
echo "\n"
wbemexec ./cimreqerr08.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <LOCALNAMESPACEPATH> element "
echo "    (different element)"
echo "wbemexec ./cimreqerr08a.xml"
echo "\n"
wbemexec ./cimreqerr08a.xml
echo "\n"
echo "\n"


echo "Invalid XML input: missing <NAMESPACE> element (no element)"
echo "wbemexec ./cimreqerr09.xml"
echo "\n"
wbemexec ./cimreqerr09.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <NAMESPACE> element (different element)"
echo "wbemexec ./cimreqerr09a.xml"
echo "\n"
wbemexec ./cimreqerr09a.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing NAME attribute for NAMESPACE element"
echo "wbemexec ./cimreqerr09b.xml"
echo "\n"
wbemexec ./cimreqerr09b.xml
echo "\n"
echo "\n"

echo "Invalid XML input: subelement other than NAMESPACE in list"
echo "wbemexec ./cimreqerr09c.xml"
echo "\n"
wbemexec ./cimreqerr09c.xml
echo "\n"
echo "\n"

echo "Invalid XML input: subelement other than NAMESPACE in list"
echo "wbemexec ./cimreqerr09d.xml"
echo "\n"
wbemexec ./cimreqerr09d.xml
echo "\n"
echo "\n"


echo "Invalid XML input: missing <CLASSNAME> element (no element)"
echo "wbemexec ./cimreqerr10.xml"
echo "\n"
wbemexec ./cimreqerr10.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing <CLASSNAME> element (different element)"
echo "wbemexec ./cimreqerr10a.xml"
echo "\n"
wbemexec ./cimreqerr10a.xml
echo "\n"
echo "\n"

echo "Invalid XML input: missing NAME attribute for CLASSNAME element"
echo "wbemexec ./cimreqerr10b.xml"
echo "\n"
wbemexec ./cimreqerr10b.xml
echo "\n"
echo "\n"

echo "Invalid input: input starts with neither xml declaration, nor HTTP M-POST or POST method request (GET method)"
echo "wbemexec ./cimreqerr01.http"
echo "\n"
wbemexec ./cimreqerr01.http
echo "\n"
echo "\n"

echo "Invalid input: input starts with neither xml declaration, nor HTTP M-POST"
echo "or POST method request (missing HTTP method)"
echo "wbemexec ./cimreqerr02.http"
echo "\n"
wbemexec ./cimreqerr02.http
echo "\n"
echo "\n"

echo "Invalid input: input starts with neither xml declaration, nor valid HTTP"
echo "M-POST or POST method request (missing HTTP URI and version) -- times out"
echo "wbemexec -t 1 ./cimreqerr03.http"
echo "\n"
wbemexec -t 1 ./cimreqerr03.http
echo "\n"
echo "\n"

