axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hawk...@apache.org
Subject cvs commit: ws-axis/c/tests/auto_build/testcases/tests FaultMappingRepeatedDoc.xml
Date Tue, 08 Feb 2005 12:13:45 GMT
hawkeye     2005/02/08 04:13:45

  Added:       c/tests/auto_build/testcases/output
                        FaultMappingRepeatedDoc.cpp.out
               c/tests/auto_build/testcases/client/cpp
                        FaultMappingRepeatedDocClient.cpp
               c/tests/auto_build/testcases/tests
                        FaultMappingRepeatedDoc.xml
  Log:
  Created a new test to catch issues with repeatedly calling the same stub. this used to fail
on Windows. it now works !
  
  Revision  Changes    Path
  1.1                  ws-axis/c/tests/auto_build/testcases/output/FaultMappingRepeatedDoc.cpp.out
  
  Index: FaultMappingRepeatedDoc.cpp.out
  ===================================================================
  0
  Trying to div 10 by 5
  Result is 2
  1
  Trying to div 10 by 0
  MathOpsService_AxisClientException: DivByZeroStruct Fault: "Division by zero exception",
1, 10.52
  2
  Trying to div 1000 by 5
  MathOpsService_AxisClientException: SpecialDetailStruct Fault: "You have entered 1000 for
the first parameter. 1000 is reserved. Please do not use it"
  3
  Trying to div 10 by -5
  MathOpsService_AxisClientException: OutOfBoundStruct Fault: "Out of bounds exception", 2,
"This bounds exception is a forced exception"
  ---------------------- TEST COMPLETE -----------------------------
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/cpp/FaultMappingRepeatedDocClient.cpp
  
  Index: FaultMappingRepeatedDocClient.cpp
  ===================================================================
  #include "MathOps.hpp"
  #include <axis/AxisException.hpp>
  #include <ctype.h>
  #include <signal.h>
  #include <iostream>
  
  void sig_handler(int);
  
  int main(int argc, char* argv[])
  {
  	char endpoint[256];
  	const char* server="localhost";
  	const char* url="http://localhost:80/axis/MathOps";
  	const char* port="80";
  	const char* op = 0;
  	const char* p1 = 0;
  	const char* p2 = 0;
  	int i1=0, i2=0;
  	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);
  
  	op = "div";
  
  	if (strcmp(op, "div") == 0)
  	{
  		// This test creates the service once and once only. It then repeatedly calls the operation
on the service
  		MathOps ws(endpoint);
  	    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;
  			}
  			try
  			{
  				cout << "Trying to " << op << " " << i1 << " by " <<
i2 << endl;
  				iResult = ws.div(i1, i2);		
  				cout << "Result is " << iResult << endl;
  			}
  			catch(MathOpsService_AxisClientException &me)
  			{
  				cout << "MathOpsService_AxisClientException: ";
  				ISoapFault *fault = (ISoapFault *)me.getFault();
  				const char* pcCmplxFaultName = fault->getCmplxFaultObjectName().c_str();
  				if(0 == strcmp("DivByZeroStruct", pcCmplxFaultName))
  				{
  					DivByZeroStruct* p = (DivByZeroStruct *)fault->getCmplxFaultObject();
  					cout << "DivByZeroStruct Fault: \"" << p->varString << "\", "
<< p->varInt << ", " << p->varFloat << endl;
              	}
  				else if(0 == strcmp("SpecialDetailStruct", pcCmplxFaultName))
  				{
  					SpecialDetailStruct* p = (SpecialDetailStruct *)fault->getCmplxFaultObject();
  					cout << "SpecialDetailStruct Fault: \"" << p->varString << "\""
<< endl;
  				}
  				else if(0 == strcmp("OutOfBoundStruct", pcCmplxFaultName))
  				{
  					OutOfBoundStruct* p = (OutOfBoundStruct *)fault->getCmplxFaultObject();
  					cout << "OutOfBoundStruct Fault: \"" << p->varString << "\", "
<< p->varInt << ", \"" << p->specialDetail->varString <<
"\"" << endl;
  				}
  			}
  			catch(AxisException& e)
  			{
                  cout << "AxisException: " << e.what() << endl;
  			}
  			catch(exception& e)
  			{
                  cout << "Unknown Exception: " << endl;
  			}
  			catch(...)
  			{
                  cout << "Unspecified Exception: " << endl;
  			}
  	    }
  	}
  	else 
  	{
  		cout << "Invalid operation " << op << endl;
  	}
  	cout << "---------------------- TEST COMPLETE -----------------------------"<<
endl;
  	
  	return 0;
  }
  
  void sig_handler(int sig) {
  	signal(sig, sig_handler);
      cout << "SIGNAL RECEIVED " << sig << endl;
  	exit(1);
  }
  
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/tests/FaultMappingRepeatedDoc.xml
  
  Index: FaultMappingRepeatedDoc.xml
  ===================================================================
  <test>
      <name>FaultMappingRepeatedDoc</name>
      <description>FaultMappingDoc but calling the same stub and not creating a new
one each call. We had problems on windows only doing this.</description>
      <clientLang>cpp</clientLang>
      <clientCode>FaultMappingRepeatedDocClient.cpp</clientCode>
      <wsdl>FaultMappingDoc.wsdl</wsdl>
      <expected>
          <output>
              FaultMappingRepeatedDoc.cpp.out
          </output>
      </expected>
  	<endpoint>http://localhost:80/FaultMapping/services/MathOps</endpoint>
  </test>
  
  
  

Mime
View raw message