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 na...@apache.org on 2006/04/28 05:34:53 UTC
svn commit: r397752 [1/2] -
/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/
Author: nadiramra
Date: Thu Apr 27 20:34:51 2006
New Revision: 397752
URL: http://svn.apache.org/viewcvs?rev=397752&view=rev
Log:
attempt to make test case code more readable ...
Modified:
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicAllTestClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicChoiceClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocProgConfigClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSL1Client.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLConfigFileClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDoc_TTestClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CombinedAllTestClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CombinedChoiceClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexListsClient.cpp
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp Thu Apr 27 20:34:51 2006
@@ -21,85 +21,81 @@
int main(int argc, char* argv[])
{
- bool bSuccess = false;
- int iRetryIterationCount = 3;
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
- do
+ do
+ {
+ try
{
- try
- {
- AttachmentBindingImpl ws(argv[1]);
-
- char *text=stringToAscii("Some attachment text");
-
- #define NUM_ATTS 6
- ISoapAttachment *att[NUM_ATTS];
- xsd__base64Binary b64b[NUM_ATTS];
-
- for (int i=0; i<NUM_ATTS; i++)
- {
- att[i] = ws.createSoapAttachment();
-
- if (1==i)
- att[i]->addHeader(AXIS_CONTENT_TYPE,"image/jpeg");
- else if (2==i)
- att[i]->addHeader("Content-Disposition","checked");
-
- b64b[i].set((unsigned char *)text, strlen(text)+1);
- att[i]->addBody(&b64b[i]);
- }
-
- xsd__int iResult = ws.put(att[0], att[1], att[2], att[3], att[4], att[5], NULL);
- cout << iResult << endl;
- bSuccess = true;
- }
- catch(AxisException& e)
- {
- bool bSilent = false;
- if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
- {
- if( iRetryIterationCount > 0)
- {
- bSilent = true;
- }
- }
- else
- {
- iRetryIterationCount = 0;
- }
-
- if( !bSilent)
- {
- cout << "Exception : " << e.what() << endl;
- }
- }
- catch(exception& e)
- {
- cout << "Unknown exception has occured" << endl;
- }
- catch(...)
- {
- cout << "Unknown exception has occured" << endl;
- }
- iRetryIterationCount--;
- } while( iRetryIterationCount > 0 && !bSuccess);
+ AttachmentBindingImpl ws(argv[1]);
- cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
- return 0;
+ char *text=stringToAscii("Some attachment text");
+
+#define NUM_ATTS 6
+ ISoapAttachment *att[NUM_ATTS];
+ xsd__base64Binary b64b[NUM_ATTS];
+
+ for (int i=0; i<NUM_ATTS; i++)
+ {
+ att[i] = ws.createSoapAttachment();
+
+ if (1==i)
+ att[i]->addHeader(AXIS_CONTENT_TYPE,"image/jpeg");
+ else if (2==i)
+ att[i]->addHeader("Content-Disposition","checked");
+
+ b64b[i].set((unsigned char *)text, strlen(text)+1);
+ att[i]->addBody(&b64b[i]);
+ }
+
+ xsd__int iResult = ws.put(att[0], att[1], att[2], att[3], att[4], att[5], NULL);
+ cout << iResult << endl;
+ bSuccess = true;
+ }
+ catch(AxisException& e)
+ {
+ bool bSilent = false;
+ if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ {
+ if( iRetryIterationCount > 0)
+ bSilent = true;
+ }
+ else
+ iRetryIterationCount = 0;
+
+ if( !bSilent)
+ cout << "Exception : " << e.what() << endl;
+ }
+ catch(exception& e)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+ catch(...)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+
+ iRetryIterationCount--;
+ }
+ while( iRetryIterationCount > 0 && !bSuccess);
+
+ cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
+ return 0;
}
void PrintUsage()
{
- printf("Usage :\n Calculator <url>\n\n");
- exit(1);
+ printf("Usage :\n Calculator <url>\n\n");
+ exit(1);
}
bool IsNumber(const char* p)
{
- for (int x=0; x < strlen(p); x++)
- {
- if (!isdigit(p[x])) return false;
- }
- return true;
+ for (int x=0; x < strlen(p); x++)
+ {
+ if (!isdigit(p[x])) return false;
+ }
+ return true;
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp Thu Apr 27 20:34:51 2006
@@ -14,9 +14,7 @@
// limitations under the License.
-/* This program will create 10 Threads and each thread will invoke AxisBench Service
- @Author James
-*/
+/* This program will create 10 Threads and each thread will invoke AxisBench Service @Author James */
#include "AxisBench.hpp"
#include <axis/AxisException.hpp>
@@ -30,16 +28,16 @@
#include "CommonClientTestCode.hpp"
#ifdef WIN32
- #include <windows.h>
- #include "sys/timeb.h"
- #define RETTYPE DWORD WINAPI
- #define ARGTYPE LPVOID
+#include <windows.h>
+#include "sys/timeb.h"
+#define RETTYPE DWORD WINAPI
+#define ARGTYPE LPVOID
#else
- #include <pthread.h>
- #include <unistd.h>
- #include "sys/time.h"
- #define RETTYPE void*
- #define ARGTYPE void*
+#include <pthread.h>
+#include <unistd.h>
+#include "sys/time.h"
+#define RETTYPE void*
+#define ARGTYPE void*
#endif
@@ -48,8 +46,8 @@
#define NUM_THREADS 5
-/* In windows the entry point function return type is DWORD WINAPI
- In linux it is void * */
+/* In windows the entry point function return type is DWORD WINAPI In linux it is void *
+ */
RETTYPE ThreadFunc(ARGTYPE Param)
{
/*Type casting the url to char * */
@@ -61,8 +59,8 @@
BenchDataType *output = NULL;
xsd__unsignedByte* buffer = NULL;
if (p!=NULL)
- url=p;
-
+ url=p;
+
int iResult;
bool bSuccess = false;
int iRetryIterationCount = 1;
@@ -74,37 +72,37 @@
sprintf(endpoint, "%s", url);
ws = new AxisBench(endpoint, APTHTTP1_1);
int request = 1;
-
+
input = new BenchDataType();
input->count = 1;
-
+
BenchBasicDataType_Array arrayIn;
-// cout <<" About to create BenchBasicDataType"<<endl;
+ // cout <<" About to create BenchBasicDataType"<<endl;
BenchBasicDataType ** ppBBDT = new BenchBasicDataType *[input->count];
- #ifdef WIN32
- __int64 ll = 10000;
- #else
- long long ll = 10000;
- #endif
+#ifdef WIN32
+ __int64 ll = 10000;
+#else
+ long long ll = 10000;
+#endif
// input->infos.m_Array = ppBBDT;
// input->infos.m_Size = input->count;
-
+
time_t tim;
tim = 1100246323;
struct tm *temp = gmtime(&tim);
struct tm lt;
memcpy(<, temp, sizeof(struct tm));
-
- char *letterA_String = stringToAscii("A");
+
+ char *letterA_String = stringToAscii("A");
buffer = (xsd__unsignedByte*)calloc (1, input->count + 2);
- strcpy ( (char *)buffer, letterA_String);
-
-// cout <<" input->count = "<<input->count<<endl;
- for ( int i = 0; i < input->count ; i++ )
+ strcpy ( (char *)buffer, letterA_String);
+
+ // cout <<" input->count = "<<input->count<<endl;
+ for ( int i = 0; i < input->count ; i++ )
{
BenchBasicDataType *type = new BenchBasicDataType();
type->StringType = "StringType";
@@ -123,54 +121,54 @@
type->ShortType = (i+1);
type->Base64BinaryType.set(buffer, i);
type->HexBinary.set(buffer, i);
-
+
ppBBDT[i] = type;
-
+
if( ll == 0)
- ll = 1;
+ ll = 1;
else
- ll += 10000;
-
+ ll += 10000;
+
strcat ( (char *)buffer, letterA_String);
}
arrayIn.set(ppBBDT,input->count);
- input->setinfos(&arrayIn);
-// cout << "About to delete the output prior to calling the service"<<endl;
- for ( int ii = 0; ii < request ; ii++ )
+ input->setinfos(&arrayIn);
+ // cout << "About to delete the output prior to calling the service"<<endl;
+ for ( int ii = 0; ii < request ; ii++ )
{
- if (output)
+ if (output)
{
int outputSize =0;
- BenchBasicDataType ** outArray =output->infos->get(outputSize);
+ BenchBasicDataType ** outArray =output->infos->get(outputSize);
for (int i = 0; i < outputSize; i++)
delete outArray[i];
delete output;
output = NULL;
}
-// cout << "About to do bench request"<<endl;
+ // cout << "About to do bench request"<<endl;
output = ws->doBenchRequest(input);
-// cout << "Done bench request"<<endl;
+ // cout << "Done bench request"<<endl;
}
free(buffer);
if ( ws->getStatus() == AXIS_FAIL )
- cout << "Failed" << endl;
- else
+ cout << "Failed" << endl;
+ else
{
bSuccess = true;
char dateTime[50];
int i = 0;
int outputSize = 0;
BenchBasicDataType ** outArray =output->infos->get(outputSize);
- for ( ; i < output->count ; i++ )
+ for ( ; i < output->count ; i++ )
{
- if ( outArray[i] != (BenchBasicDataType *) 0xcdcdcdcd)
- cout << " StringType " << outArray[i]->StringType << endl;
+ if ( outArray[i] != (BenchBasicDataType *) 0xcdcdcdcd)
+ cout << " StringType " << outArray[i]->StringType << endl;
}
-
- // returnValue=0;
+
+ // returnValue=0;
}
}
catch(AxisException& e)
@@ -179,14 +177,14 @@
if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
{
- if( iRetryIterationCount > 0)
- bSilent = true;
+ if( iRetryIterationCount > 0)
+ bSilent = true;
}
else
- iRetryIterationCount = 0;
+ iRetryIterationCount = 0;
if( !bSilent)
- cout << "Exception : " << e.what() << endl;
+ cout << "Exception : " << e.what() << endl;
}
catch(exception& e)
{
@@ -196,31 +194,31 @@
{
cout << "Unknown exception has occured" << endl;
}
-
+
try
{
- delete ws;
- delete input;
- if (output)
+ delete ws;
+ delete input;
+ if (output)
delete output;
}
catch(exception& exception)
{
- cout << "Exception on clean up: " << exception.what()<<endl;
+ cout << "Exception on clean up: " << exception.what()<<endl;
}
catch(...)
{
- cout << "Unknown exception on clean up: " << endl;
+ cout << "Unknown exception on clean up: " << endl;
}
-
- iRetryIterationCount--;
- }
+
+ iRetryIterationCount--;
+ }
while( iRetryIterationCount > 1 && !bSuccess);
-
- #ifndef WIN32
- pthread_exit(0);
- #endif
-
+
+#ifndef WIN32
+ pthread_exit(0);
+#endif
+
return 0;
}
@@ -230,63 +228,59 @@
int main(int argc, char *argv[])
{
Axis::initialize(false);
- try{
- int i;
- #ifdef WIN32
- /*Windows specific code comes here */
- HANDLE hThread[NUM_THREADS];
- for(i=0;i<NUM_THREADS;i++){
- DWORD dwThreadId;
- //LPVOID dwThrdParam = LPVOID(argv[1]);
- hThread[i] = CreateThread(
- NULL, // no security attributes
- 0, // use default stack size
- ThreadFunc, // thread function
- LPVOID(argv[1]), // argument to thread function
- 0,
- &dwThreadId); // returns the thread identifier
-
- if (hThread[i] == NULL)
- {
- cout<<"Thread creation Failed";
- }
- }
- /* Waiting for threads to terminate */
- WaitForMultipleObjects(NUM_THREADS,hThread,true, INFINITE);
- for(i=0;i<NUM_THREADS;i++)
- CloseHandle( hThread[i] );
-
- #else
- pthread_t thread[NUM_THREADS];
- pthread_attr_t attr;
- int rc, t;
- void *status;
- // Initialize and set thread detached attribute
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
- for (t = 0; t < NUM_THREADS; t++)
- {
- /*Creating threads */
- rc = pthread_create(&thread[t], &attr, ThreadFunc,(void *)argv[1]);
- if (rc)
- {
- cout<<"Thread Creation Failed";
- }
- }
- //Free attribute and wait for the other threads
- pthread_attr_destroy(&attr);
- /* Wait for the threads to terminate */
- for(t=0;t<NUM_THREADS;t++){
- rc = pthread_join(thread[t], &status);
- if (rc)
- {
- cout<<"ERROR from pthread_join()"<<endl;
- }
- }
- #endif
- }catch(exception &e){
- cout<< e.what();
- }
- cout<<endl <<"----------------------------------TEST COMPLETE--------------------------------"<<endl;
+ try
+ {
+ int i;
+#ifdef WIN32
+ /*Windows specific code comes here */
+ HANDLE hThread[NUM_THREADS];
+ for(i=0;i<NUM_THREADS;i++){
+ DWORD dwThreadId;
+ //LPVOID dwThrdParam = LPVOID(argv[1]);
+ hThread[i] = CreateThread(
+ NULL, // no security attributes
+ 0, // use default stack size
+ ThreadFunc, // thread function
+ LPVOID(argv[1]), // argument to thread function
+ 0,
+ &dwThreadId); // returns the thread identifier
+
+ if (hThread[i] == NULL)
+ cout<<"Thread creation Failed";
+ }
+ /* Waiting for threads to terminate */
+ WaitForMultipleObjects(NUM_THREADS,hThread,true, INFINITE);
+ for(i=0;i<NUM_THREADS;i++)
+ CloseHandle( hThread[i] );
+
+#else
+ pthread_t thread[NUM_THREADS];
+ pthread_attr_t attr;
+ int rc, t;
+ void *status;
+ // Initialize and set thread detached attribute
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+ for (t = 0; t < NUM_THREADS; t++)
+ {
+ /*Creating threads */
+ rc = pthread_create(&thread[t], &attr, ThreadFunc,(void *)argv[1]);
+ if (rc)
+ cout<<"Thread Creation Failed";
+ }
+ //Free attribute and wait for the other threads
+ pthread_attr_destroy(&attr);
+ /* Wait for the threads to terminate */
+ for(t=0;t<NUM_THREADS;t++)
+ {
+ rc = pthread_join(thread[t], &status);
+ if (rc)
+ cout<<"ERROR from pthread_join()"<<endl;
+ }
+#endif
+ }catch(exception &e){
+ cout<< e.what();
+ }
+ cout<<endl <<"----------------------------------TEST COMPLETE--------------------------------"<<endl;
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicAllTestClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicAllTestClient.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicAllTestClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicAllTestClient.cpp Thu Apr 27 20:34:51 2006
@@ -26,91 +26,85 @@
int returnValue = 1; // Assume Failure
- if (argc > 1)
+ if (argc > 1)
{
- // Watch for special case help request
- if (!strncmp (argv[1], "-", 1)) // Check for - only so that it works for
- //-?, -h or --help; -anything
- {
- usage (argv[0], endpoint);
- return 2;
- }
- sprintf (endpoint, argv[1]);
+ // Watch for special case help request
+ if (!strncmp (argv[1], "-", 1)) // Check for - only so that it works for
+ //-?, -h or --help; -anything
+ {
+ usage (argv[0], endpoint);
+ return 2;
}
+ sprintf (endpoint, argv[1]);
+ }
- bool bSuccess = false;
+ bool bSuccess = false;
int iRetryIterationCount = 3;
- do
+ do
{
- try
- {
- AllTestSoap ws (endpoint, APTHTTP1_1);
-
- AllComplexType* inParam = new AllComplexType();
- inParam->IntValue = new int;
- *(inParam->IntValue) = 5;
- inParam->StringValue = "HELLO";
-
- printf("\nSending.................");
- printf("\nIntValue = %d",*(inParam->IntValue));
- printf("\nStringValue= %s",inParam->StringValue);
-
- ws.setTransportProperty("SOAPAction" , "BasicAll#echoAll");
- AllComplexType* outParam = ws.echoAll(inParam);
-
- if (outParam != NULL)
- {
- printf("\n\nReceived................");
- printf("\nIntValue = %d",*(outParam->IntValue));
- printf("\nStringValue= %s",outParam->StringValue);
- printf("\n\nSuccessfull\n");
- }
- else
- printf("\nFault\n");
-
- bSuccess = true;
- delete inParam;
- delete outParam;
- }
- catch (AxisException & e)
- {
- bool bSilent = false;
-
- if (e.getExceptionCode () ==
- CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
- {
- if (iRetryIterationCount > 0)
- {
- bSilent = true;
- }
- }
- else
- {
- iRetryIterationCount = 0;
- }
-
- if (!bSilent)
- {
- printf ("%s\n", e.what ());
- }
- }
- catch (exception & e)
- {
- printf ("%s\n", e.what ());
- }
- catch (...)
- {
- cout << "Unknown Exception occured." << endl;
- }
+ try
+ {
+ AllTestSoap ws (endpoint, APTHTTP1_1);
+
+ AllComplexType* inParam = new AllComplexType();
+ inParam->IntValue = new int;
+ *(inParam->IntValue) = 5;
+ inParam->StringValue = "HELLO";
+
+ printf("\nSending.................");
+ printf("\nIntValue = %d",*(inParam->IntValue));
+ printf("\nStringValue= %s",inParam->StringValue);
+
+ ws.setTransportProperty("SOAPAction" , "BasicAll#echoAll");
+ AllComplexType* outParam = ws.echoAll(inParam);
+
+ if (outParam != NULL)
+ {
+ printf("\n\nReceived................");
+ printf("\nIntValue = %d",*(outParam->IntValue));
+ printf("\nStringValue= %s",outParam->StringValue);
+ printf("\n\nSuccessfull\n");
+ }
+ else
+ printf("\nFault\n");
+
+ bSuccess = true;
+ delete inParam;
+ delete outParam;
+ }
+ catch (AxisException & e)
+ {
+ bool bSilent = false;
+
+ if (e.getExceptionCode () ==
+ CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ {
+ if (iRetryIterationCount > 0)
+ bSilent = true;
+ }
+ else
+ iRetryIterationCount = 0;
+
+ if (!bSilent)
+ printf ("%s\n", e.what ());
+ }
+ catch (exception & e)
+ {
+ printf ("%s\n", e.what ());
+ }
+ catch (...)
+ {
+ cout << "Unknown Exception occured." << endl;
+ }
- iRetryIterationCount--;
+ iRetryIterationCount--;
- }while (iRetryIterationCount > 0 && !bSuccess);
+ }while (iRetryIterationCount > 0 && !bSuccess);
cout <<
- "---------------------- TEST COMPLETE -----------------------------"
- << endl;
+ "---------------------- TEST COMPLETE -----------------------------"
+ << endl;
return returnValue;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicChoiceClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicChoiceClient.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicChoiceClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/BasicChoiceClient.cpp Thu Apr 27 20:34:51 2006
@@ -7,26 +7,27 @@
int main(int argc, char *argv[])
{
-
- try
- {
-
- const char* url="http://localhost:80/axis/BasicChoice";
- ChoiceComplexType* Value0=new ChoiceComplexType();
- ChoiceComplexType* Value1;
- Value0->name0="Choice Test";
- Value0->name1=NULL;
-
- url = argv[1];
- ChoiceTestSoap ws(url);
-
- cout<< "Calling the Service..."<<endl;
-
- Value1=ws.echoChoice(Value0);
- cout<<"Value1->name0 = "<<Value1->name0<<endl;
+ try
+ {
+
+ const char* url="http://localhost:80/axis/BasicChoice";
+ ChoiceComplexType* Value0=new ChoiceComplexType();
+ ChoiceComplexType* Value1;
+ Value0->name0="Choice Test";
+ Value0->name1=NULL;
+
+ url = argv[1];
+ ChoiceTestSoap ws(url);
+
+ cout<< "Calling the Service..."<<endl;
- }catch (AxisException & e)
+ Value1=ws.echoChoice(Value0);
+
+ cout<<"Value1->name0 = "<<Value1->name0<<endl;
+
+ }
+ catch (AxisException & e)
{
printf ("Exception : %s\n", e.what ());
}
@@ -38,7 +39,8 @@
{
printf ("Unknown exception has occured\n");
}
- return 0;
+
+ return 0;
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorClient.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorClient.cpp Thu Apr 27 20:34:51 2006
@@ -21,116 +21,94 @@
static void usage( char * programName, char * defaultURL)
{
cout << "\nUsage:\n"
- << programName << " [-? | div number1 number2 [service_url]]\n"
- << " -? Show this help.\n"
- << " service_url URL of the service.\n"
- << " Default service URL is assumed to be " << defaultURL << endl;
+ << programName << " [-? | div number1 number2 [service_url]]\n"
+ << " -? Show this help.\n"
+ << " service_url URL of the service.\n"
+ << " Default service URL is assumed to be " << defaultURL << endl;
}
int main( int argc, char * argv[])
{
char * pszURL = "http://localhost/axis/calculator";
- // Set default service URL
-
try
{
- if( argc == 1)
- {
- usage( argv[0], pszURL);
-
- return 2;
- }
-
- if( argc > 1)
- {
- if( argv[1] == "-")
- {
-// Check for - only so that it works for -?, -h or --help; -anything
-
- usage( argv[0], pszURL);
-
- return 2;
- }
-
-// Less than minimum number of args OR greater than maximum number of args
- else if( argc < 4 || argc > 5)
- {
- usage( argv[0], pszURL);
-
- return 2;
- }
- else if( argc == 5)
- {
- pszURL = argv[4];
- }
- }
-
-// cout << endl << " Using service at " << pszURL << endl << endl;
-
- Calculator ws( pszURL);
-
- char * pszOperation = argv[1];
- char * pValue1 = argv[2];
- char * pValue2 = argv[3];
-
- if( !IsNumber( pValue1))
- {
- cout << "Invalid value for first <parameter> " << pValue1 << endl << endl;
+ if( argc == 1)
+ {
+ usage( argv[0], pszURL);
+ return 2;
+ }
+ if( argc > 1)
+ {
+ if( argv[1] == "-")
+ {
+ // Check for - only so that it works for -?, -h or --help; -anything
+ usage( argv[0], pszURL);
+ return 2;
+ }
+
+ // Less than minimum number of args OR greater than maximum number of args
+ else if( argc < 4 || argc > 5)
+ {
+ usage( argv[0], pszURL);
+ return 2;
+ }
+ else if( argc == 5)
+ pszURL = argv[4];
+ }
+
+ // cout << endl << " Using service at " << pszURL << endl << endl;
+
+ Calculator ws( pszURL);
+
+ char * pszOperation = argv[1];
+ char * pValue1 = argv[2];
+ char * pValue2 = argv[3];
+
+ if( !IsNumber( pValue1))
+ {
+ cout << "Invalid value for first <parameter> " << pValue1 << endl << endl;
usage( argv[0], pszURL);
-
- return 2;
- }
-
- if( !IsNumber( pValue2))
- {
- cout << "Invalid value for second <parameter> " << pValue2 << endl << endl;
+ return 2;
+ }
+ if( !IsNumber( pValue2))
+ {
+ cout << "Invalid value for second <parameter> " << pValue2 << endl << endl;
usage( argv[0], pszURL);
-
- return 2;
- }
-
- int iValue1 = atoi( pValue1);
- int iValue2 = atoi( pValue2);
-
- if( strcmp( pszOperation, "add") == 0)
- {
- cout << ws.add( iValue1, iValue2) << endl;
- }
- else if( strcmp( pszOperation, "sub") == 0)
- {
- cout << ws.sub( iValue1, iValue2) << endl;
- }
- else if( strcmp( pszOperation, "mul") == 0)
- {
- cout << ws.mul( iValue1, iValue2) << endl;
- }
- else if( strcmp( pszOperation, "div") == 0)
- {
- cout << ws.div( iValue1, iValue2) << endl;
- }
- else
- {
- cout << "Invalid operation " << pszOperation << endl << endl;
+ return 2;
+ }
- usage( argv[0], pszURL);
+ int iValue1 = atoi( pValue1);
+ int iValue2 = atoi( pValue2);
- return 2;
- }
+ if( strcmp( pszOperation, "add") == 0)
+ cout << ws.add( iValue1, iValue2) << endl;
+ else if( strcmp( pszOperation, "sub") == 0)
+ cout << ws.sub( iValue1, iValue2) << endl;
+ else if( strcmp( pszOperation, "mul") == 0)
+ cout << ws.mul( iValue1, iValue2) << endl;
+ else if( strcmp( pszOperation, "div") == 0)
+ cout << ws.div( iValue1, iValue2) << endl;
+ else
+ {
+ cout << "Invalid operation " << pszOperation << endl << endl;
+ usage( argv[0], pszURL);
+ return 2;
+ }
}
catch (AxisException & e)
{
- cout << "Exception : " << e.what () << endl;
+ cout << "Exception : " << e.what () << endl;
}
catch (exception & e)
{
- cout << "Unknown exception has occurred : " << e.what () << endl;
+ cout << "Unknown exception has occurred : " << e.what () << endl;
}
catch (...)
{
- cout << "Unknown exception has occurred" << endl;
+ cout << "Unknown exception has occurred" << endl;
}
return 0;
@@ -139,12 +117,8 @@
bool IsNumber( const char * p)
{
for( int x = 0; x < (int) strlen( p); x++)
- {
- if( !isdigit( p[x]))
- {
- return false;
- }
- }
+ if( !isdigit( p[x]))
+ return false;
return true;
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp Thu Apr 27 20:34:51 2006
@@ -33,157 +33,140 @@
int main( int argc, char * argv[])
{
- char * pURL = "http://localhost:80/axis/Calculator";
- char * pOpList[] = {"add", "sub", "mul", "div", "*"};
- int iValue1List[] = {2, 5, 23, 5879, 123, 76, 94, 3987, 432, 65, 0};
- int iValue2List[] = {3, 99, 243, 8, 987, 987, 45, 908, -45, 0};
- int iResult;
- int iIndex_Value1List = 0;
- int iIndex_Value2List = 0;
- EOPERATION eOperation = eAdd;
- bool bSuccess = false;
- int iRetryIterationCount = 3;
- char cSign;
- int iIterationCount = 20000;
- int iIteration;
-
- signal( SIGILL, sig_handler);
- signal( SIGABRT, sig_handler);
- signal( SIGSEGV, sig_handler);
- signal( SIGFPE, sig_handler);
-
- if( argc > 0)
- {
- pURL = argv[1];
- }
-
- do
+ char * pURL = "http://localhost:80/axis/Calculator";
+ char * pOpList[] = {"add", "sub", "mul", "div", "*"};
+ int iValue1List[] = {2, 5, 23, 5879, 123, 76, 94, 3987, 432, 65, 0};
+ int iValue2List[] = {3, 99, 243, 8, 987, 987, 45, 908, -45, 0};
+ int iResult;
+ int iIndex_Value1List = 0;
+ int iIndex_Value2List = 0;
+ EOPERATION eOperation = eAdd;
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
+ char cSign;
+ int iIterationCount = 20000;
+ int iIteration;
+
+ signal( SIGILL, sig_handler);
+ signal( SIGABRT, sig_handler);
+ signal( SIGSEGV, sig_handler);
+ signal( SIGFPE, sig_handler);
+
+ if( argc > 0)
+ pURL = argv[1];
+
+ do
+ {
+ try
{
- try
- {
- Calculator ws( pURL);
+ Calculator ws( pURL);
- cout << "Invoke the same web service method " << iIterationCount << " times without closing the connection." << endl;
+ cout << "Invoke the same web service method " << iIterationCount << " times without closing the connection."
+ << endl;
- for( iIteration = 0; iIteration < iIterationCount; iIteration++)
+ for( iIteration = 0; iIteration < iIterationCount; iIteration++)
+ {
+ switch( eOperation)
+ {
+ case eAdd:
{
- switch( eOperation)
- {
- case eAdd:
- {
- iResult = ws.add( iValue1List[iIndex_Value1List],
- iValue2List[iIndex_Value2List]);
- cSign = '+';
- eOperation = eSub;
- break;
- }
-
- case eSub:
- {
- iResult = ws.sub( iValue1List[iIndex_Value1List],
- iValue2List[iIndex_Value2List]);
- cSign = '-';
- eOperation = eMul;
- break;
- }
-
- case eMul:
- {
- iResult = ws.mul( iValue1List[iIndex_Value1List],
- iValue2List[iIndex_Value2List]);
- cSign = '*';
- eOperation = eDiv;
- break;
- }
-
- case eDiv:
- {
- iResult = ws.div( iValue1List[iIndex_Value1List],
- iValue2List[iIndex_Value2List]);
- cSign = '/';
- eOperation = eAdd;
- break;
- }
- }
-
- if( iIteration == iIterationCount / 4)
- {
- cout << "Quarter of the way there!" << endl;
- }
- else if( iIteration == iIterationCount / 2)
- {
- cout << "Half of the way there!" << endl;
- }
- else if( iIteration == (3 * iIterationCount) / 4)
- {
- cout << "Three quarters of the way there!" << endl;
- }
- else if( iIteration == iIterationCount - 1)
- {
- cout << "All the way there!" << endl;
-
- bSuccess = true;
- }
-
- if( iValue1List[++iIndex_Value1List] == 0)
- {
- iIndex_Value1List = 0;
- }
-
- if( iValue2List[++iIndex_Value2List] == 0)
- {
- iIndex_Value2List = 0;
- }
+ iResult = ws.add( iValue1List[iIndex_Value1List],
+ iValue2List[iIndex_Value2List]);
+ cSign = '+';
+ eOperation = eSub;
+ break;
}
- }
- catch( AxisException& e)
- {
- bool bSilent = false;
- if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ case eSub:
{
- if( iRetryIterationCount > 1)
- {
- bSilent = true;
- }
+ iResult = ws.sub( iValue1List[iIndex_Value1List],
+ iValue2List[iIndex_Value2List]);
+ cSign = '-';
+ eOperation = eMul;
+ break;
}
- else
+
+ case eMul:
{
- iRetryIterationCount = 0;
+ iResult = ws.mul( iValue1List[iIndex_Value1List],
+ iValue2List[iIndex_Value2List]);
+ cSign = '*';
+ eOperation = eDiv;
+ break;
}
- if( !bSilent)
+ case eDiv:
{
- cout << "Exception : " << e.what() << endl;
+ iResult = ws.div( iValue1List[iIndex_Value1List],
+ iValue2List[iIndex_Value2List]);
+ cSign = '/';
+ eOperation = eAdd;
+ break;
}
}
- catch( exception& e)
- {
- cout << "Exception has occured:" << e.what() << endl;
- }
- catch(...)
+
+ if( iIteration == iIterationCount / 4)
+ cout << "Quarter of the way there!" << endl;
+ else if( iIteration == iIterationCount / 2)
+ cout << "Half of the way there!" << endl;
+ else if( iIteration == (3 * iIterationCount) / 4)
+ cout << "Three quarters of the way there!" << endl;
+ else if( iIteration == iIterationCount - 1)
{
- cout << "Unknown exception has occured" << endl;
+ cout << "All the way there!" << endl;
+ bSuccess = true;
}
- if( !bSuccess)
- {
- iRetryIterationCount--;
+ if( iValue1List[++iIndex_Value1List] == 0)
+ iIndex_Value1List = 0;
- cout << "Iteration: " << iIteration << " " << iValue1List[iIndex_Value1List] << cSign << iValue2List[iIndex_Value2List] << "=" << iResult << endl;
- }
+ if( iValue2List[++iIndex_Value2List] == 0)
+ iIndex_Value2List = 0;
+ }
+ }
+ catch( AxisException& e)
+ {
+ bool bSilent = false;
+
+ if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ {
+ if( iRetryIterationCount > 1)
+ bSilent = true;
+ }
+ else
+ iRetryIterationCount = 0;
+
+ if( !bSilent)
+ cout << "Exception : " << e.what() << endl;
+ }
+ catch( exception& e)
+ {
+ cout << "Exception has occured:" << e.what() << endl;
+ }
+ catch(...)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+
+ if( !bSuccess)
+ {
+ iRetryIterationCount--;
+
+ cout << "Iteration: " << iIteration << " " << iValue1List[iIndex_Value1List] << cSign <<
+ iValue2List[iIndex_Value2List] << "=" << iResult << endl;
+ }
+
+ } while( iRetryIterationCount > 0 && !bSuccess);
- } while( iRetryIterationCount > 0 && !bSuccess);
+ cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
- cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
-
- return 0;
+ return 0;
}
void sig_handler( int sig)
{
- signal( sig, sig_handler);
+ signal( sig, sig_handler);
cout << "SIGNAL RECEIVED " << sig << endl;
- exit( 1);
+ exit( 1);
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocProgConfigClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocProgConfigClient.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocProgConfigClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocProgConfigClient.cpp Thu Apr 27 20:34:51 2006
@@ -26,202 +26,175 @@
int main( int argc, char* argv[])
{
- char endpoint[256];
- char * url = "http://localhost:80/axis/Calculator";
- char * libhome = NULL;
- char parserlocation[255];
- char httptransportlocation[255];
- char httpchannellocation[255];
- int iResult;
-
- signal( SIGILL, sig_handler);
- signal( SIGABRT, sig_handler);
- signal( SIGSEGV, sig_handler);
- //signal( SIGQUIT, sig_handler);
- //signal( SIGBUS, sig_handler);
- signal( SIGFPE, sig_handler);
-
- url = argv[1];
-
- bool bSuccess = false;
- int iRetryIterationCount = 3;
-
- do
+ char endpoint[256];
+ char * url = "http://localhost:80/axis/Calculator";
+ char * libhome = NULL;
+ char parserlocation[255];
+ char httptransportlocation[255];
+ char httpchannellocation[255];
+ int iResult;
+
+ signal( SIGILL, sig_handler);
+ signal( SIGABRT, sig_handler);
+ signal( SIGSEGV, sig_handler);
+ //signal( SIGQUIT, sig_handler);
+ //signal( SIGBUS, sig_handler);
+ signal( SIGFPE, sig_handler);
+
+ url = argv[1];
+
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
+
+ do
+ {
+ try
{
- try
- {
- sprintf( endpoint, "%s", url);
-
- AxisCPPConfigDefaults config;
- char * installdir = NULL;
-
- if( (installdir = getenv( "INSTALLDIR")) == NULL)
- {
- cout << "Error - Environment variable 'INSTALLDIR' has not been set." << endl;
-
- installdir = getenv( "AXISCPP_DEPLOY");
- }
-
- config.setAxisHome( installdir);
- config.setClientLog( "Client.taw");
-
- char wsddfile[255];
-
- sprintf( wsddfile, "%s/%s", installdir, "ClientFile.wsdd");
-
- config.setClientWSDDFile( wsddfile);
-
- if( (libhome = getenv( "LIBHOME")) == NULL)
- {
- cout << "Error - Environment variable 'LIBHOME' has not been set." << endl;
+ sprintf( endpoint, "%s", url);
- libhome = new char[ strlen( installdir) + 10];
+ AxisCPPConfigDefaults config;
+ char * installdir = NULL;
- sprintf( libhome, "%s/obj/bin", installdir);
- }
+ if( (installdir = getenv( "INSTALLDIR")) == NULL)
+ {
+ cout << "Error - Environment variable 'INSTALLDIR' has not been set." << endl;
+ installdir = getenv( "AXISCPP_DEPLOY");
+ }
+
+ config.setAxisHome( installdir);
+ config.setClientLog( "Client.taw");
+
+ char wsddfile[255];
+ sprintf( wsddfile, "%s/%s", installdir, "ClientFile.wsdd");
+ config.setClientWSDDFile( wsddfile);
+
+ if( (libhome = getenv( "LIBHOME")) == NULL)
+ {
+ cout << "Error - Environment variable 'LIBHOME' has not been set." << endl;
+ libhome = new char[ strlen( installdir) + 10];
+ sprintf( libhome, "%s/obj/bin", installdir);
+ }
#if defined WIN32
- sprintf( parserlocation, "%s/%s", libhome, "AxisXMLParser.dll");
- sprintf( httptransportlocation,"%s/%s", libhome, "HTTPTransport.dll");
- sprintf( httpchannellocation, "%s/%s", libhome, "HTTPChannel.dll");
-
- config.setXMLParserLibrary( parserlocation);
- config.setHTTPTransportLibrary( httptransportlocation);
- config.setHTTPChannelLibrary( httpchannellocation);
+ sprintf( parserlocation, "%s/%s", libhome, "AxisXMLParser.dll");
+ sprintf( httptransportlocation,"%s/%s", libhome, "HTTPTransport.dll");
+ sprintf( httpchannellocation, "%s/%s", libhome, "HTTPChannel.dll");
+
+ config.setXMLParserLibrary( parserlocation);
+ config.setHTTPTransportLibrary( httptransportlocation);
+ config.setHTTPChannelLibrary( httpchannellocation);
#elif defined AIX
- sprintf( parserlocation, "%s/%s", libhome, "libaxis_xmlparser.a");
- sprintf( httptransportlocation, "%s/%s", libhome, "libhttp_transport.a");
- sprintf( httpchannellocation, "%s/%s", libhome, "libhttp_channel.a");
-
- config.setXMLParserLibrary( parserlocation);
- config.setHTTPTransportLibrary( httptransportlocation);
- config.setHTTPChannelLibrary( httpchannellocation);
+ sprintf( parserlocation, "%s/%s", libhome, "libaxis_xmlparser.a");
+ sprintf( httptransportlocation, "%s/%s", libhome, "libhttp_transport.a");
+ sprintf( httpchannellocation, "%s/%s", libhome, "libhttp_channel.a");
+
+ config.setXMLParserLibrary( parserlocation);
+ config.setHTTPTransportLibrary( httptransportlocation);
+ config.setHTTPChannelLibrary( httpchannellocation);
#else
- sprintf( parserlocation, "%s/%s", libhome, "libaxis_xmlparser.so");
- sprintf( httptransportlocation, "%s/%s", libhome, "libhttp_transport.so");
- sprintf( httpchannellocation, "%s/%s", libhome, "libhttp_channel.so");
-
- config.setXMLParserLibrary( parserlocation);
- config.setHTTPTransportLibrary( httptransportlocation);
- config.setHTTPChannelLibrary( httpchannellocation);
+ sprintf( parserlocation, "%s/%s", libhome, "libaxis_xmlparser.so");
+ sprintf( httptransportlocation, "%s/%s", libhome, "libhttp_transport.so");
+ sprintf( httpchannellocation, "%s/%s", libhome, "libhttp_channel.so");
+
+ config.setXMLParserLibrary( parserlocation);
+ config.setHTTPTransportLibrary( httptransportlocation);
+ config.setHTTPChannelLibrary( httpchannellocation);
#endif
- config.apply();
-// axishome = config.getAxisHome();
-// cout << "Axis Home = " << axishome << endl;
-
- char * wsddfile1 = NULL;
-
- wsddfile1 = config.getClientWSDDFile();
-
- cout << "Client Log file name = " << config.getClientLog() << endl;
-
- if( strcmp( parserlocation, config.getXMLParserLibrary()) == 0)
- {
- cout << "XML Parser is matched" << endl;
- }
- else
- {
- cout << "XML parser is not matched" << endl;
- }
-
- if( strcmp( httptransportlocation, config.getHTTPTransportLibrary()) == 0)
- {
- cout << "HTTP Transport is matched" << endl;
- }
- else
- {
- cout << "HTTP Transport is not matched" << endl;
- }
-
- if( strcmp( httpchannellocation, config.getHTTPChannelLibrary()) == 0)
- {
- cout << "HTTP Channel lib is matched" << endl;
- }
- else
- {
- cout << "HTTP Channel is not matched" << endl;
- }
-
- Calculator ws( endpoint);
-
- char * op = "add";
- int i1 = 2;
- int i2 = 3;
-
- if( strcmp( op, "add") == 0)
- {
- iResult = ws.add( i1, i2);
-
- cout << iResult << endl;
-
- bSuccess = true;
- }
- }
- catch( AxisException& e)
- {
- bool bSilent = false;
-
- if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
- {
- if( iRetryIterationCount > 1)
- {
- bSilent = true;
- }
- }
- else
- {
- iRetryIterationCount = 0;
- }
-
- if( !bSilent)
- {
- cout << "Exception : " << e.what() << endl;
- }
- }
- catch( exception& e)
- {
- cout << "Unknown exception has occured : " << e.what() << endl;
- }
- catch( ...)
- {
- cout << "Unknown exception has occured" << endl;
- }
-
- iRetryIterationCount--;
- } while( iRetryIterationCount > 0 && !bSuccess);
-
- cout << "---------------------- TEST COMPLETE -----------------------------" << endl;
+ config.apply();
+ // axishome = config.getAxisHome(); cout << "Axis Home = " << axishome << endl;
+
+ char * wsddfile1 = NULL;
+ wsddfile1 = config.getClientWSDDFile();
+ cout << "Client Log file name = " << config.getClientLog() << endl;
+
+ if( strcmp( parserlocation, config.getXMLParserLibrary()) == 0)
+ cout << "XML Parser is matched" << endl;
+ else
+ cout << "XML parser is not matched" << endl;
+
+ if( strcmp( httptransportlocation, config.getHTTPTransportLibrary()) == 0)
+ cout << "HTTP Transport is matched" << endl;
+ else
+ cout << "HTTP Transport is not matched" << endl;
+
+ if( strcmp( httpchannellocation, config.getHTTPChannelLibrary()) == 0)
+ cout << "HTTP Channel lib is matched" << endl;
+ else
+ cout << "HTTP Channel is not matched" << endl;
+
+ Calculator ws( endpoint);
+
+ char * op = "add";
+ int i1 = 2;
+ int i2 = 3;
+
+ if( strcmp( op, "add") == 0)
+ {
+ iResult = ws.add( i1, i2);
+ cout << iResult << endl;
+ bSuccess = true;
+ }
+ }
+ catch( AxisException& e)
+ {
+ bool bSilent = false;
+
+ if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ {
+ if( iRetryIterationCount > 1)
+ bSilent = true;
+ }
+ else
+ iRetryIterationCount = 0;
+
+ if( !bSilent)
+ cout << "Exception : " << e.what() << endl;
+ }
+ catch( exception& e)
+ {
+ cout << "Unknown exception has occured : " << e.what() << endl;
+ }
+ catch( ...)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+
+ iRetryIterationCount--;
+ }
+ while( iRetryIterationCount > 0 && !bSuccess);
+
+ cout << "---------------------- TEST COMPLETE -----------------------------" << endl;
- return 0;
+ return 0;
}
void PrintUsage()
{
- cout << "Usage :" << endl << "Calculator <url>" << endl << endl;
+ cout << "Usage :" << endl << "Calculator <url>" << endl << endl;
- exit( 1);
+ exit( 1);
}
bool IsNumber( const char * p)
{
- for( int x = 0; x < (int) strlen( p); x++)
+ for( int x = 0; x < (int) strlen( p); x++)
+ {
+ if( !isdigit( p[x]))
{
- if( !isdigit( p[x]))
- {
- return false;
- }
+ return false;
}
+ }
- return true;
+ return true;
}
void sig_handler( int sig)
{
- signal( sig, sig_handler);
+ signal( sig, sig_handler);
cout << "SIGNAL RECEIVED " << sig << endl;
-
- exit( 1);
+
+ exit( 1);
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSL1Client.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSL1Client.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSL1Client.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSL1Client.cpp Thu Apr 27 20:34:51 2006
@@ -28,77 +28,71 @@
int main(int argc, char* argv[])
{
- char endpoint[256];
- const char* url="https://localhost:80/axis/Calculator";
- int iResult;
- const char* sslkeyhome = 0;
- char keylocation[255];
-
- signal(SIGILL, sig_handler);
- signal(SIGABRT, sig_handler);
- signal(SIGSEGV, sig_handler);
- //signal(SIGQUIT, sig_handler);
- //signal(SIGBUS, sig_handler);
- signal(SIGFPE, sig_handler);
+ char endpoint[256];
+ const char* url="https://localhost:80/axis/Calculator";
+ int iResult;
+ const char* sslkeyhome = 0;
+ char keylocation[255];
+
+ signal(SIGILL, sig_handler);
+ signal(SIGABRT, sig_handler);
+ signal(SIGSEGV, sig_handler);
+ //signal(SIGQUIT, sig_handler);
+ //signal(SIGBUS, sig_handler);
+ signal(SIGFPE, sig_handler);
- url = argv[1];
+ url = argv[1];
- bool bSuccess = false;
- int iRetryIterationCount = 3;
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
- do
- {
+ do
+ {
try
{
- sprintf(endpoint, "%s", url);
- Calculator ws(endpoint);
- //ws.SetSecure("/home/axistest/ssl/myKeyRing.kdb", "axxxis4all", "AXIS", "NONE", "05", "NONE", false);
- sslkeyhome=getenv("SSL_KEYS_HOME");
-
- if (!sslkeyhome)
- { cout << "SSL_KEYS_HOME not set" << endl;
- return 1;
- }
-
- sprintf(keylocation,"%s/%s",sslkeyhome,"myKeyRing.kdb");
- ws.SetSecure(keylocation, "axxxxis4all", "AXIS", "NONE", "05", "NONE", false);
-
-
- iResult = ws.add(2,3);
- cout << iResult <<endl;
- bSuccess = true;
+ sprintf(endpoint, "%s", url);
+ Calculator ws(endpoint);
+ sslkeyhome=getenv("SSL_KEYS_HOME");
+
+ if (!sslkeyhome)
+ {
+ cout << "SSL_KEYS_HOME not set" << endl;
+ return 1;
+ }
+
+ sprintf(keylocation,"%s/%s",sslkeyhome,"myKeyRing.kdb");
+ ws.SetSecure(keylocation, "axxxxis4all", "AXIS", "NONE", "05", "NONE", false);
+
+ iResult = ws.add(2,3);
+ cout << iResult <<endl;
+ bSuccess = true;
}
catch(AxisException& e)
{
- bool bSilent = false;
+ bool bSilent = false;
- if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
- {
- if( iRetryIterationCount > 0)
- {
- bSilent = true;
- }
- }
- else
- {
- iRetryIterationCount = 0;
- }
+ if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ {
+ if( iRetryIterationCount > 0)
+ bSilent = true;
+ }
+ else
+ iRetryIterationCount = 0;
if( !bSilent)
- {
- // Since OS400 error message is different, ensure that
- // correct error message is returned and then return
- // what is expected to match verification file.
+ {
+ // Since OS400 error message is different, ensure that correct error message is returned and then return
+ // what is expected to match verification file.
#ifdef __OS400__
char *errorText = (char *)e.what();
if (strstr(errorText, "GSKit Error 408") != NULL)
- cout << "Exception : " << " (GSKit Error 408 - GSK_ERROR_BAD_KEYFILE_PASSWORD)" << endl;
+ cout << "Exception : " << " (GSKit Error 408 - GSK_ERROR_BAD_KEYFILE_PASSWORD)" << endl;
else
- cout << "Exception : " << e.what() << endl;
+ cout << "Exception : " << e.what() << endl;
#else
- cout << "Exception : " << e.what() << endl;
+ cout << "Exception : " << e.what() << endl;
#endif
- }
+ }
}
catch(exception& e)
{
@@ -108,15 +102,18 @@
{
cout << "Unknown exception has occured" << endl;
}
- iRetryIterationCount--;
- } while( iRetryIterationCount > 0 && !bSuccess);
- cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
- return 0;
+
+ iRetryIterationCount--;
+ }
+ while( iRetryIterationCount > 0 && !bSuccess);
+
+ cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
+ return 0;
}
void sig_handler(int sig) {
- signal(sig, sig_handler);
+ signal(sig, sig_handler);
cout << "SIGNAL RECEIVED " << sig << endl;
- exit(1);
+ exit(1);
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLClient.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLClient.cpp Thu Apr 27 20:34:51 2006
@@ -29,36 +29,35 @@
int main(int argc, char* argv[])
{
char endpoint[256];
- const char* sslkeyhome = 0;
+ const char* sslkeyhome = 0;
char keylocation[255];
-
+
const char* url="https://localhost:80/axis/Calculator";
- signal(SIGILL, sig_handler);
- signal(SIGABRT, sig_handler);
- signal(SIGSEGV, sig_handler);
- //signal(SIGQUIT, sig_handler);
- //signal(SIGBUS, sig_handler);
- signal(SIGFPE, sig_handler);
+ signal(SIGILL, sig_handler);
+ signal(SIGABRT, sig_handler);
+ signal(SIGSEGV, sig_handler);
+ //signal(SIGQUIT, sig_handler);
+ //signal(SIGBUS, sig_handler);
+ signal(SIGFPE, sig_handler);
int iResult;
url = argv[1];
- bool bSuccess = false;
- int iRetryIterationCount = 3;
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
- do
- {
+ do
+ {
try
{
sprintf(endpoint, "%s", url);
Calculator ws(endpoint);
- //ws.SetSecure("/home/axistest/ssl/myKeyRing.kdb", "axis4all", "AXIS", "NONE", "05", "NONE", false);
sslkeyhome=getenv("SSL_KEYS_HOME");
if (!sslkeyhome)
{
- cout << "SSL_KEYS_HOME not set" << endl;
+ cout << "SSL_KEYS_HOME not set" << endl;
return 1;
}
@@ -67,28 +66,22 @@
iResult = ws.add(2,3);
cout << iResult << endl;
- bSuccess = true;
+ bSuccess = true;
}
catch(AxisException& e)
{
- bool bSilent = false;
+ bool bSilent = false;
- if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
- {
- if( iRetryIterationCount > 0)
- {
- bSilent = true;
- }
- }
- else
- {
- iRetryIterationCount = 0;
- }
+ if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ {
+ if( iRetryIterationCount > 0)
+ bSilent = true;
+ }
+ else
+ iRetryIterationCount = 0;
if( !bSilent)
- {
- cout << "Exception : " << e.what() << endl;
- }
+ cout << "Exception : " << e.what() << endl;
}
catch(exception& e)
{
@@ -98,15 +91,17 @@
{
cout << "Unknown exception has occured" << endl;
}
- iRetryIterationCount--;
- } while( iRetryIterationCount > 0 && !bSuccess);
- cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
- return 0;
+ iRetryIterationCount--;
+ }
+ while( iRetryIterationCount > 0 && !bSuccess);
+
+ cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
+ return 0;
}
void sig_handler(int sig) {
- signal(sig, sig_handler);
+ signal(sig, sig_handler);
cout << "SIGNAL RECEIVED " << sig << endl;
- exit(1);
+ exit(1);
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLConfigFileClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLConfigFileClient.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLConfigFileClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLConfigFileClient.cpp Thu Apr 27 20:34:51 2006
@@ -29,57 +29,51 @@
int main(int argc, char* argv[])
{
char endpoint[256];
- const char* sslkeyhome = 0;
+ const char* sslkeyhome = 0;
char keylocation[255];
-
+
const char* url="https://localhost:80/axis/Calculator";
- signal(SIGILL, sig_handler);
- signal(SIGABRT, sig_handler);
- signal(SIGSEGV, sig_handler);
- //signal(SIGQUIT, sig_handler);
- //signal(SIGBUS, sig_handler);
- signal(SIGFPE, sig_handler);
-
+ signal(SIGILL, sig_handler);
+ signal(SIGABRT, sig_handler);
+ signal(SIGSEGV, sig_handler);
+ //signal(SIGQUIT, sig_handler);
+ //signal(SIGBUS, sig_handler);
+ signal(SIGFPE, sig_handler);
+
int iResult;
url = argv[1];
- bool bSuccess = false;
- int iRetryIterationCount = 3;
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
- do
- {
+ do
+ {
try
{
sprintf(endpoint, "%s", url);
-
+
Calculator ws(endpoint);
iResult = ws.add(2,3);
cout << iResult << endl;
-
- bSuccess = true;
+
+ bSuccess = true;
}
catch(AxisException& e)
{
- bool bSilent = false;
+ bool bSilent = false;
- if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
- {
- if( iRetryIterationCount > 0)
- {
- bSilent = true;
- }
- }
- else
- {
- iRetryIterationCount = 0;
- }
+ if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ {
+ if( iRetryIterationCount > 0)
+ bSilent = true;
+ }
+ else
+ iRetryIterationCount = 0;
if( !bSilent)
- {
- cout << "Exception : " << e.what() << endl;
- }
+ cout << "Exception : " << e.what() << endl;
}
catch(exception& e)
{
@@ -89,15 +83,17 @@
{
cout << "Unknown exception has occured" << endl;
}
- iRetryIterationCount--;
- } while( iRetryIterationCount > 0 && !bSuccess);
- cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
- return 0;
+ iRetryIterationCount--;
+ }
+ while( iRetryIterationCount > 0 && !bSuccess);
+
+ cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
+ return 0;
}
void sig_handler(int sig) {
- signal(sig, sig_handler);
+ signal(sig, sig_handler);
cout << "SIGNAL RECEIVED " << sig << endl;
- exit(1);
+ exit(1);
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDoc_TTestClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDoc_TTestClient.cpp?rev=397752&r1=397751&r2=397752&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDoc_TTestClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDoc_TTestClient.cpp Thu Apr 27 20:34:51 2006
@@ -27,14 +27,14 @@
#include <axis/Axis.hpp>
/* Defining platform specific constants */
#ifdef WIN32
- #include <windows.h>
- #define RETTYPE DWORD WINAPI
- #define ARGTYPE LPVOID
+#include <windows.h>
+#define RETTYPE DWORD WINAPI
+#define ARGTYPE LPVOID
#else
- #include <pthread.h>
- #include <unistd.h>
- #define RETTYPE void*
- #define ARGTYPE void*
+#include <pthread.h>
+#include <unistd.h>
+#define RETTYPE void*
+#define ARGTYPE void*
#endif
@@ -43,159 +43,142 @@
#define NUM_THREADS 10
-/* In windows the entry point function return type is DWORD WINAPI
- In linux it is void * */
+/* In windows the entry point function return type is DWORD WINAPI In linux it is void *
+ */
RETTYPE ThreadFunc(ARGTYPE Param)
{
- /*Type casting the url to char * */
- char * p = (char *) Param;
- char endpoint[256];
- char * url="http://puppet.in.ibm.com:9060/Calculator/services/Calculator";
-
- if( p != NULL)
- {
- url = p;
- }
-
- int iResult;
- bool bSuccess = false;
- int iRetryIterationCount = 3;
-
- do
- {
- try
- {
- sprintf( endpoint, "%s", url);
-
- Calculator ws( endpoint);
-
- iResult = ws.add( 3, 2);
-
- cout << iResult;
-
- bSuccess = true;
- }
- catch( AxisException& e)
- {
- bool bSilent = false;
-
- if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
- {
- if( iRetryIterationCount > 0)
- {
- bSilent = true;
- }
- }
- else
- {
- iRetryIterationCount = 0;
- }
-
- if( !bSilent)
- {
- cout << "Exception : " << e.what() << endl;
- }
- }
- catch( exception& e)
- {
- cout << "Unknown exception has occured" << endl;
- }
- catch( ...)
- {
- cout << "Unknown exception has occured" << endl;
- }
-
- iRetryIterationCount--;
-
- } while( iRetryIterationCount > 0 && !bSuccess);
-
- #ifndef WIN32
- pthread_exit( 0);
- #endif
+ /*Type casting the url to char * */
+ char * p = (char *) Param;
+ char endpoint[256];
+ char * url="http://puppet.in.ibm.com:9060/Calculator/services/Calculator";
+
+ if( p != NULL)
+ url = p;
+
+ int iResult;
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
- return 0;
+ do
+ {
+ try
+ {
+ sprintf( endpoint, "%s", url);
+
+ Calculator ws( endpoint);
+ iResult = ws.add( 3, 2);
+
+ cout << iResult;
+ bSuccess = true;
+ }
+ catch( AxisException& e)
+ {
+ bool bSilent = false;
+
+ if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ {
+ if( iRetryIterationCount > 0)
+ bSilent = true;
+ }
+ else
+ iRetryIterationCount = 0;
+
+ if( !bSilent)
+ cout << "Exception : " << e.what() << endl;
+ }
+ catch( exception& e)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+ catch( ...)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+
+ iRetryIterationCount--;
+
+ }
+ while( iRetryIterationCount > 0 && !bSuccess);
+
+#ifndef WIN32
+ pthread_exit( 0);
+#endif
+
+ return 0;
}
//-----------------------------------------------------------------------------
int main( int argc, char * argv[])
{
- Axis::initialize( false);
+ Axis::initialize( false);
- try
- {
- int i;
+ try
+ {
+ int i;
#ifdef WIN32
- // Windows specific code comes here
- HANDLE hThread[NUM_THREADS];
+ // Windows specific code comes here
+ HANDLE hThread[NUM_THREADS];
- for( i = 0; i < NUM_THREADS; i++)
- {
- DWORD dwThreadId;
- //LPVOID dwThrdParam = LPVOID(argv[1]);
-
- hThread[i] = CreateThread( NULL, // no security attributes
- 0, // use default stack size
- ThreadFunc, // thread function
- LPVOID(argv[1]), // argument to thread function
- 0,
- &dwThreadId); // returns the thread identifier
-
- if( hThread[i] == NULL)
- {
- cout << "Thread creation Failed";
- }
- }
- // Waiting for threads to terminate
- WaitForMultipleObjects( NUM_THREADS, hThread, true, INFINITE);
-
- for( i = 0; i < NUM_THREADS; i++)
- {
- CloseHandle( hThread[i]);
- }
-#else
- pthread_t thread[NUM_THREADS];
- pthread_attr_t attr;
- int rc;
- int t;
- void * status;
-
- // Initialize and set thread detached attribute
- pthread_attr_init( &attr);
- pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE);
-
- for( t = 0; t < NUM_THREADS; t++)
- {
- //Creating threads
- rc = pthread_create( &thread[t], &attr, ThreadFunc, (void *) argv[1]);
-
- if( rc)
- {
- cout << "Thread Creation Failed";
- }
- }
-
- //Free attribute and wait for the other threads
- pthread_attr_destroy( &attr);
-
- // Wait for the threads to terminate
- for( t = 0; t < NUM_THREADS; t++)
- {
- rc = pthread_join( thread[t], &status);
-
- if( rc)
- {
- cout << "ERROR from pthread_join()" << endl;
- }
- }
-#endif
+ for( i = 0; i < NUM_THREADS; i++)
+ {
+ DWORD dwThreadId;
+ //LPVOID dwThrdParam = LPVOID(argv[1]);
+
+ hThread[i] = CreateThread( NULL, // no security attributes
+ 0, // use default stack size
+ ThreadFunc, // thread function
+ LPVOID(argv[1]), // argument to thread function
+ 0,
+ &dwThreadId); // returns the thread identifier
+
+ if( hThread[i] == NULL)
+ cout << "Thread creation Failed";
}
- catch( exception &e)
+ // Waiting for threads to terminate
+ WaitForMultipleObjects( NUM_THREADS, hThread, true, INFINITE);
+
+ for( i = 0; i < NUM_THREADS; i++)
+ CloseHandle( hThread[i]);
+#else
+ pthread_t thread[NUM_THREADS];
+ pthread_attr_t attr;
+ int rc;
+ int t;
+ void * status;
+
+ // Initialize and set thread detached attribute
+ pthread_attr_init( &attr);
+ pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE);
+
+ for( t = 0; t < NUM_THREADS; t++)
+ {
+ //Creating threads
+ rc = pthread_create( &thread[t], &attr, ThreadFunc, (void *) argv[1]);
+
+ if( rc)
+ cout << "Thread Creation Failed";
+ }
+
+ //Free attribute and wait for the other threads
+ pthread_attr_destroy( &attr);
+
+ // Wait for the threads to terminate
+ for( t = 0; t < NUM_THREADS; t++)
{
- cout << e.what();
+ rc = pthread_join( thread[t], &status);
+
+ if( rc)
+ cout << "ERROR from pthread_join()" << endl;
}
+#endif
+ }
+ catch( exception &e)
+ {
+ cout << e.what();
+ }
- cout << endl << "----------------------------------TEST COMPLETE--------------------------------" << endl;
+ cout << endl << "----------------------------------TEST COMPLETE--------------------------------" << endl;
}