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 wh...@apache.org on 2005/07/08 18:18:16 UTC

cvs commit: ws-axis/c/tests/auto_build/testcases/dynamic/DynamicSetSOAPMethodAttrTest2 Calculator.cpp

whitlock    2005/07/08 09:18:16

  Modified:    c/src/common Param.cpp
               c/tests/auto_build/testcases/dynamic/DynamicCheckFaultTest
                        Calculator.cpp
               c/tests/auto_build/testcases/dynamic/DynamicGetAnyObjectSOAPFaultTest
                        Calculator.cpp
               c/tests/auto_build/testcases/dynamic/DynamicGetNamespacePrefixTest
                        Calculator.cpp
               c/tests/auto_build/testcases/dynamic/DynamicGetSOAPSerializerTest
                        Calculator.cpp
               c/tests/auto_build/testcases/dynamic/DynamicGet_AddAnyObjectTestOutOfScope
                        Calculator.cpp
               c/tests/auto_build/testcases/dynamic/DynamicGet_AddAnyObjectTest
                        Calculator.cpp
               c/tests/auto_build/testcases/dynamic/DynamicSOAPVersionTest
                        Calculator.cpp
               c/tests/auto_build/testcases/dynamic/DynamicSetSOAPMethodAttrTest1
                        Calculator.cpp
               c/tests/auto_build/testcases/dynamic/DynamicSetSOAPMethodAttrTest2
                        Calculator.cpp
  Log:
  Fix DynamicSetSOAPMethodAttrTest2 test by not testing adding duplicate attributes.
  Change free(m_pCall) in many testcases to delete m_pCall, since m_pCall was new'ed. This caused the AnyObject testcases to break since now ~Call failed during ~Param. The fix to this is to not delete the atorage for the AnyObject since it is the user's storage and the AnyObject has never brrn cloned. It is up to the application to delete this storage.
  
  Revision  Changes    Path
  1.58      +2 -7      ws-axis/c/src/common/Param.cpp
  
  Index: Param.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/Param.cpp,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- Param.cpp	8 Jul 2005 14:43:40 -0000	1.57
  +++ Param.cpp	8 Jul 2005 16:18:15 -0000	1.58
  @@ -57,13 +57,8 @@
               delete m_Value.pCplxObj;
               break;
           case XSD_ANY:
  -            pAny = (AnyType*)m_Value.pAnyObject;
  -            for (i=0; i<pAny->_size; i++)
  -            {
  -                pStr = pAny->_array[i];
  -                if (pStr) delete [] pStr;
  -            }
  -            delete [] pAny;
  +			// Do not delete the m_Value.pAnyObject here because it is the
  +			// application's storage. The AnyObject has never been cloned.
               break;
           default:;
       }
  
  
  
  1.4       +1 -1      ws-axis/c/tests/auto_build/testcases/dynamic/DynamicCheckFaultTest/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynamicCheckFaultTest/Calculator.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Calculator.cpp	23 Mar 2005 15:45:08 -0000	1.3
  +++ Calculator.cpp	8 Jul 2005 16:18:15 -0000	1.4
  @@ -39,7 +39,7 @@
   
   Calculator::~Calculator()
   {
  -	free(m_pCall);
  +	delete m_pCall;
   	m_pCall=NULL;
   }
   
  
  
  
  1.3       +1 -1      ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGetAnyObjectSOAPFaultTest/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGetAnyObjectSOAPFaultTest/Calculator.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Calculator.cpp	23 Mar 2005 15:45:08 -0000	1.2
  +++ Calculator.cpp	8 Jul 2005 16:18:16 -0000	1.3
  @@ -43,7 +43,7 @@
   
   Calculator::~Calculator()
   {
  -	free(m_pCall);
  +	delete m_pCall;
   	m_pCall=NULL;
   }
   
  
  
  
  1.8       +1 -1      ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGetNamespacePrefixTest/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGetNamespacePrefixTest/Calculator.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Calculator.cpp	23 Mar 2005 15:45:08 -0000	1.7
  +++ Calculator.cpp	8 Jul 2005 16:18:16 -0000	1.8
  @@ -41,7 +41,7 @@
   
   Calculator::~Calculator()
   {
  -	free(m_pCall);
  +	delete m_pCall;
   	m_pCall=NULL;
   }
   
  
  
  
  1.4       +1 -1      ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGetSOAPSerializerTest/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGetSOAPSerializerTest/Calculator.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Calculator.cpp	23 Mar 2005 15:45:08 -0000	1.3
  +++ Calculator.cpp	8 Jul 2005 16:18:16 -0000	1.4
  @@ -38,7 +38,7 @@
   
   Calculator::~Calculator()
   {
  -	free(m_pCall);
  +	delete m_pCall;
   	m_pCall=NULL;
   }
   
  
  
  
  1.5       +1 -1      ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGet_AddAnyObjectTestOutOfScope/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGet_AddAnyObjectTestOutOfScope/Calculator.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Calculator.cpp	24 Jun 2005 13:36:36 -0000	1.4
  +++ Calculator.cpp	8 Jul 2005 16:18:16 -0000	1.5
  @@ -43,7 +43,7 @@
   
   Calculator::~Calculator()
   {
  -	free(m_pCall);
  +	delete m_pCall;
   	m_pCall=NULL;
   }
   
  
  
  
  1.4       +25 -26    ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGet_AddAnyObjectTest/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynamicGet_AddAnyObjectTest/Calculator.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Calculator.cpp	23 Mar 2005 15:45:08 -0000	1.3
  +++ Calculator.cpp	8 Jul 2005 16:18:16 -0000	1.4
  @@ -43,7 +43,7 @@
   
   Calculator::~Calculator()
   {
  -	free(m_pCall);
  +	delete m_pCall;
   	m_pCall=NULL;
   }
   
  @@ -63,9 +63,7 @@
   
   xsd__int Calculator::div(xsd__int Value0, xsd__int Value1)
   {
  -	xsd__int Ret = 0;
  -	AnyType * any;
  -	AnyType* pAny = new AnyType();
  +	AnyType *pAny = new AnyType();
       pAny->_size = 2;
       pAny->_array = new char*[2];
   	char *p=new char[100];
  @@ -74,7 +72,7 @@
   	sprintf(p,"<ns1:arg_1_3>%d</ns1:arg_1_3>",Value1);
   	//pAny->_array[1]=strdup("<ns1:arg_1_3>0</ns1:arg_1_3>");
   	pAny->_array[1]=strdup(p);
  -	const char* pcCmplxFaultName;
  +
   	try
   	{	
   		m_pCall->initialize(CPP_DOC_PROVIDER);
  @@ -82,36 +80,37 @@
   		m_pCall->setSOAPVersion(SOAP_VER_1_1);
   		m_pCall->setOperation("div", "http://localhost/axis/Calculator");
   		includeSecure();
  -		char cPrefixAndParamName0[17];	
  -		cout<<endl<<m_pCall->addAnyObject(pAny)<<endl;	
  -	if (AXIS_SUCCESS == m_pCall->invoke())
  -	{
  -		if(AXIS_SUCCESS == m_pCall->checkMessage("divResponse", "http://localhost/axis/Calculator"))
  +		cout << endl << m_pCall->addAnyObject(pAny) << endl;	
  +		if (AXIS_SUCCESS == m_pCall->invoke())
   		{
  -			any = (AnyType*)m_pCall->getAnyObject();
  -			if(any!=NULL){
  -				cout << any->_size<<endl;
  -				cout << any->_array[0]<<endl;
  -			}			
  +			if(AXIS_SUCCESS == m_pCall->checkMessage("divResponse", "http://localhost/axis/Calculator"))
  +			{
  +				AnyType *any = (AnyType*)m_pCall->getAnyObject();
  +				if(any!=NULL)
  +				{
  +					cout << any->_size<<endl;
  +					cout << any->_array[0]<<endl;
  +				}			
  +			}
   		}
  -
  -	}
  -	
   	}
   	catch(AxisException& e)
   	{
  -		any = (AnyType*)m_pCall->getAnyObject();
  -		if(any!=NULL){
  -				cout << any->_size<<endl;
  -				cout << any->_array[0]<<endl;
  +		AnyType *any = (AnyType*)m_pCall->getAnyObject();
  +		if(any!=NULL)
  +		{
  +			cout << any->_size<<endl;
  +			cout << any->_array[0]<<endl;
   		}
   		throw;
   	}
  +
   	m_pCall->unInitialize();
  +	free(pAny->_array[0]);
  +	free(pAny->_array[1]);
   	delete pAny;
   	delete p;
  -	return Ret;
  -	
  +	return 0;
   }
   
   
  @@ -137,11 +136,11 @@
   	}
   	catch(AxisException& e)
   	{
  -	    cout << "Exception : " << e.what() << endl;
  +	    cout << "AxisException : " << e.what() << endl;
   	}
   	catch(exception& e)
   	{
  -	    cout << "Unknown exception has occured" << endl;
  +	    cout << "Unknown exception has occured : " << e.what() << endl;
   	}
   	catch(...)
   	{
  
  
  
  1.4       +1 -1      ws-axis/c/tests/auto_build/testcases/dynamic/DynamicSOAPVersionTest/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynamicSOAPVersionTest/Calculator.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Calculator.cpp	23 Mar 2005 15:45:08 -0000	1.3
  +++ Calculator.cpp	8 Jul 2005 16:18:16 -0000	1.4
  @@ -36,7 +36,7 @@
   
   Calculator::~Calculator()
   {
  -	free(m_pCall);
  +	delete m_pCall;
   	m_pCall=NULL;
   }
   
  
  
  
  1.3       +1 -1      ws-axis/c/tests/auto_build/testcases/dynamic/DynamicSetSOAPMethodAttrTest1/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynamicSetSOAPMethodAttrTest1/Calculator.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Calculator.cpp	7 Jul 2005 16:29:01 -0000	1.2
  +++ Calculator.cpp	8 Jul 2005 16:18:16 -0000	1.3
  @@ -36,7 +36,7 @@
   
   Calculator::~Calculator()
   {
  -	free(m_pCall);
  +	delete m_pCall;
   	m_pCall=NULL;
   }
   
  
  
  
  1.2       +4 -21     ws-axis/c/tests/auto_build/testcases/dynamic/DynamicSetSOAPMethodAttrTest2/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynamicSetSOAPMethodAttrTest2/Calculator.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Calculator.cpp	21 Jun 2005 14:26:44 -0000	1.1
  +++ Calculator.cpp	8 Jul 2005 16:18:16 -0000	1.2
  @@ -28,15 +28,9 @@
   	m_pCall->setEndpointURI(pcEndpointUri);
   }
   
  -Calculator::Calculator()
  -{
  -	m_pCall=new Call();
  -	m_pCall->setEndpointURI("http://localhost/axis/Calculator");
  -}
  -
   Calculator::~Calculator()
   {
  -	free(m_pCall);
  +	delete m_pCall;
   	m_pCall=NULL;
   }
   
  @@ -48,8 +42,6 @@
   {
   	xsd__int Ret = 0;
   	const char* pcCmplxFaultName;
  -	try
  -	{	
   	m_pCall->initialize(CPP_DOC_PROVIDER);
   	m_pCall->setTransportProperty(SOAPACTION_HEADER , "Calculator#div");
   	m_pCall->setSOAPVersion(SOAP_VER_1_1);
  @@ -67,18 +59,15 @@
   	m_pCall->setSOAPMethodAttribute("Name","","http://localhost/axis/Calculator","Axis");
   
   	/* Checking whether API creates duplicate Attribute. An element cannot have two attributes with same name */ 
  -	m_pCall->setSOAPMethodAttribute("Name","","http://localhost/axis/Calculator","Duplicate");
  +	// m_pCall->setSOAPMethodAttribute("Name","","http://localhost/axis/Calculator","Duplicate");
   
   	/* Adding another SOAP Method Attribute - Type  */
  -
   	m_pCall->setSOAPMethodAttribute("Type","ns1","http://axis.apache.org","Open Source");
   
      /* Adding another SOAP Method Attribute - Lang. API will create a namespace prefix  */
  -
   	m_pCall->setSOAPMethodAttribute("Lang","","http://axis.apache.org","C++");
   
   	/* Adding another SOAP Method Attribute - Lang. API will create a namespace prefix  */
  -
   	m_pCall->setSOAPMethodAttribute("Attr","","","withoutPrefix");
   
   	/* Passing NULL as argument */
  @@ -96,11 +85,6 @@
   	}
   	m_pCall->unInitialize();
   	return Ret;
  -	}
  -	catch(AxisException& e)
  -	{
  -		throw;
  -	}
   }
   
   /*Methods for supporting SecureChannel*/
  @@ -130,7 +114,6 @@
   {
   	char endpoint[256];
   	const char* url="http://localhost:9080/Calculator/services/Calculator";
  -	const char* op = 0;
   	int i1=100, i2=20;
   	int iResult;
   	if(argc > 1){
  @@ -145,11 +128,11 @@
   	}
   	catch(AxisException& e)
   	{
  -	     cout << "Exception : " <<  e.what()<< endl;		
  +	     cout << "AxisException : " <<  e.what()<< endl;		
   	}
   	catch(exception& e)
   	{
  -	    cout << "Unknown exception has occured" << endl;
  +	    cout << "Unknown exception has occured : " << e.what() << endl;
   	}
   	catch(...)
   	{