You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2005/08/08 16:03:13 UTC
cvs commit: ws-axis/c/tests/auto_build/testcases/client/cpp LargeReturningStringClient.cpp
prestonf 2005/08/08 07:03:13
Modified: c/tests/auto_build/testcases/client/cpp
LargeReturningStringClient.cpp
Log:
Added debug information to be displayed iff actual output string length !=requested output string length.
Revision Changes Path
1.9 +96 -58 ws-axis/c/tests/auto_build/testcases/client/cpp/LargeReturningStringClient.cpp
Index: LargeReturningStringClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/LargeReturningStringClient.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- LargeReturningStringClient.cpp 23 Mar 2005 15:45:06 -0000 1.8
+++ LargeReturningStringClient.cpp 8 Aug 2005 14:03:13 -0000 1.9
@@ -25,47 +25,77 @@
ofstream output_file;
// Prototype
-bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint);
-void shift_args(int i, int *argc, char *argv[]);
-void setLogOptions(const char *output_filename);
+bool parse_args_for_endpoint( int * argc, char * argv[], char ** endpoint);
+void shift_args( int i, int * argc, char * argv[]);
+void setLogOptions( const char * output_filename);
-int main(int argc, char* argv[])
+int main( int argc, char * argv[])
{
- LargeReturningString *ws;
+ LargeReturningString * ws;
+ char * endpoint = WSDL_DEFAULT_ENDPOINT;
+ bool endpoint_set = false;
+ int returnValue = 1; // Assume Failure
+
+ endpoint_set = parse_args_for_endpoint( &argc, argv, &endpoint);
+
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
+
+ do
+ {
+ try
+ {
+ if( endpoint_set)
+ {
+ ws = new LargeReturningString( endpoint, APTHTTP1_1);
+ free( endpoint);
+ endpoint_set = false;
+ }
+ else
+ {
+ ws = new LargeReturningString();
+ }
- char *endpoint = WSDL_DEFAULT_ENDPOINT;
- bool endpoint_set = false;
- int returnValue = 1; // Assume Failure
-
- endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
-
- bool bSuccess = false;
- int iRetryIterationCount = 3;
-
- do
- {
- try {
- if(endpoint_set) {
- ws = new LargeReturningString(endpoint, APTHTTP1_1);
- free(endpoint);
- endpoint_set = false;
- } else
- ws = new LargeReturningString();
-
- int input = 2*1024*1024;
- xsd__string result = "";
- result = ws->getLargeString(input);
-
- cout << "Result" << endl;
- if ( result == NULL ) {
- cout << "NULL" << endl;
- } else {
- cout << strlen(result) << endl;
- returnValue = 0; // Success
- }
+ int input = 2 * 1024 * 1024;
+ xsd__string result = "";
+
+ result = ws->getLargeString(input);
+
+ cout << "Result" << endl;
+
+ if ( result == NULL)
+ {
+ cout << "NULL" << endl;
+ }
+
+ if( strlen( result) == input)
+ {
+ cout << strlen( result) << endl;
+ }
+ else
+ {
+ int iError = 0;
+
+ for( int x = 0; x < input; x++)
+ {
+ if( result[x] != 'a' + (x + iError) % 26)
+ {
+ cout << "Error. result[" << x << "] should have been " << (char) ('a' + x % 26) << " but was " << result[x] << endl;
+
+ iError++;
+ }
+ }
+
+ cout << "There where " << iError << " errors." << endl;
+ cout << "Requested " << input << " bytes. Received " << strlen( result) << " bytes." << endl;
+
+ returnValue = 0; // Success
+ }
- bSuccess = true;
- } catch(AxisException &e) {
+ bSuccess = true;
+ }
+ catch( AxisException &e)
+ {
bool bSilent = false;
if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
@@ -82,30 +112,38 @@
if( !bSilent)
{
- cerr << e.what() << endl;
+ cerr << e.what() << endl;
}
- } catch(...) {
- cerr << "Unknown Exception occured." << endl;
- }
- try
- {
- delete ws;
- }
- catch(exception& exception)
- {
- cout << "Exception on clean up of ws: " << exception.what()<<endl;
- }
- catch(...)
- {
- cout << "Unknown exception on clean up of ws: " << endl;
- }
+ }
+ catch( ...)
+ {
+ cerr << "Unknown Exception occured." << endl;
+ }
+
+ try
+ {
+ delete ws;
+ }
+ catch( exception& exception)
+ {
+ cout << "Exception on clean up of ws: " << exception.what() << endl;
+ }
+ catch( ...)
+ {
+ cout << "Unknown exception on clean up of ws: " << endl;
+ }
+
iRetryIterationCount--;
- } while( iRetryIterationCount > 0 && !bSuccess);
- if(endpoint_set)
- free(endpoint);
- cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+ } while( iRetryIterationCount > 0 && !bSuccess);
+
+ if( endpoint_set)
+ {
+ free( endpoint);
+ }
+
+ cout << "---------------------- TEST COMPLETE -----------------------------" << endl;
- return returnValue;
+ return returnValue;
}
/* Spin through args list and check for -e -p and -s options.