axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamej...@apache.org
Subject svn commit: r368617 - /webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/FaultMappingClient.cpp
Date Fri, 13 Jan 2006 06:41:22 GMT
Author: jamejose
Date: Thu Jan 12 22:41:08 2006
New Revision: 368617

URL: http://svn.apache.org/viewcvs?rev=368617&view=rev
Log:
Made client code same as FaultMappingDoc Test

Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/FaultMappingClient.cpp

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/FaultMappingClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/FaultMappingClient.cpp?rev=368617&r1=368616&r2=368617&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/FaultMappingClient.cpp
(original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/FaultMappingClient.cpp
Thu Jan 12 22:41:08 2006
@@ -16,9 +16,11 @@
 #include "MathOps.hpp"
 #include <axis/AxisException.hpp>
 #include <ctype.h>
+#include <signal.h>
+#include <iostream>
 
-void PrintUsage();
-bool IsNumber(const char* p);
+void sig_handler(int);
+using namespace std;
 
 int main(int argc, char* argv[])
 {
@@ -30,40 +32,86 @@
 	const char* p1 = 0;
 	const char* p2 = 0;
 	int i1=0, i2=0;
-    int iResult;
+	int iResult;
+	char* pcDetail;
+
+	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];
 
 	sprintf(endpoint, "%s", url);
-	MathOps ws(endpoint);
 
 	op = "div";
 
 	if (strcmp(op, "div") == 0)
 	{
-            for(int i = 0; i < 4; i++)
-            {
-                printf("%d\n", i);
-                switch(i)
-                {
-                    case 0: i1 = 10; i2 = 5; break;
-                    case 1: i1 = 10; i2 = 0; break;
-                    case 2: i1 = 1000; i2 = 5; break;
-                    case 3: i1 = 10; i2 = -5; break;
-                }
+	    for(int i = 0; i < 4; i++)
+	    {
+            cout << i << endl;
+
+			switch(i)
+			{
+				case 0: i1 = 10; i2 = 5; break;
+				case 1: i1 = 10; i2 = 0; break;
+				case 2: i1 = 1000; i2 = 5; break;
+				case 3: i1 = 10; i2 = -5; break;
+			}
 		bool bSuccess = false;
 		int	iRetryIterationCount = 3;
 
 		do
 		{
-                try
-                {
-		    iResult = ws.div(i1, i2);		
-                    printf("Result is:%d\n", iResult);
-					bSuccess = true;
-                }
-                catch(AxisException& e)
-                {
+			try
+			{
+				MathOps ws(endpoint);
+				if( iRetryIterationCount == 3)
+					cout << "Trying to " << op << " " << i1 << " by " <<
i2 << endl;
+				iResult = ws.div(i1, i2);		
+				cout << "Result is " << iResult << endl;
+				bSuccess = true;
+			}
+			catch(DivByZeroStruct& dbzs)
+			{
+				cout << "DivByZeroStruct Fault: \"" 
+					<< dbzs.varString 
+					<< "\", " 
+					<< dbzs.varInt 
+					<< ", " 
+					<< dbzs.varFloat 
+					<< endl; 
+				bSuccess = true;
+			}
+			catch(SpecialDetailStruct& sds)
+			{
+				cout << "SpecialDetailStruct Fault: \"" 
+					<< sds.varString 
+					<< "\"" 
+					<< endl;
+				bSuccess = true;
+			}
+			catch(OutOfBoundStruct& oobs)
+			{
+				cout << "OutOfBoundStruct Fault: \"" 
+					<< oobs.varString 
+					<< "\", " 
+					<< oobs.varInt 
+					<< ", \"" 
+					<< oobs.specialDetail->varString 
+					<< "\"" 
+					<< endl;
+				bSuccess = true;
+			}
+			catch(SoapFaultException& sfe)
+			{
+				cout << "SoapFaultException: " << sfe.what() << endl;
+			}
+			catch(AxisException& e)
+			{
 			bool bSilent = false;
 
 			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
@@ -80,39 +128,33 @@
 
             if( !bSilent)
 			{
-                    printf("Exception : %s\n", e.what());
+				cout << "Exception : " << e.what() << endl;
+			}
+			}
+			catch(exception& e)
+			{
+                cout << "Unknown Exception: " << endl;
+			}
+			catch(...)
+			{
+                cout << "Unspecified Exception: " << endl;
 			}
-                }
-                catch(exception& e)
-                {
-                    printf("Exception : %s\n", e.what());
-                }
-                catch(...)
-                {
-                }
 		iRetryIterationCount--;
 		} while( iRetryIterationCount > 0 && !bSuccess);
-            }
+	    }
 	}
 	else 
 	{
-		printf("Invalid operation %s\n\n", op);
-		PrintUsage();
+		cout << "Invalid operation " << op << endl;
 	}
+	cout << "---------------------- TEST COMPLETE -----------------------------"<<
endl;
+	
 	return 0;
 }
 
-void PrintUsage()
-{
-	printf("Usage :\n MathOps <server> <port> <operation> <parameter>
<parameter>\n\n");
+void sig_handler(int sig) {
+	signal(sig, sig_handler);
+    cout << "SIGNAL RECEIVED " << sig << endl;
 	exit(1);
 }
 
-bool IsNumber(const char* p)
-{
-	for (int x=1; x < strlen(p); x++)
-	{
-		if (!isdigit(p[x])) return false;
-	}
-	return true;
-}



Mime
View raw message