You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ja...@apache.org on 2005/11/11 13:01:37 UTC

svn commit: r332534 - /webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArraysClient.cpp

Author: jamejose
Date: Fri Nov 11 04:01:25 2005
New Revision: 332534

URL: http://svn.apache.org/viewcvs?rev=332534&view=rev
Log:
Updated the testcase with new Array APIs

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

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArraysClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArraysClient.cpp?rev=332534&r1=332533&r2=332534&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArraysClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArraysClient.cpp Fri Nov 11 04:01:25 2005
@@ -41,42 +41,49 @@
 		SimpleArrays ws(endpoint);
 
 		xsd__boolean_Array boolean_in;
-		xsd__boolean_Array boolean_out;
+		xsd__boolean_Array* boolean_out;
 		xsd__short_Array short_in;
 		//xsd__byte_Array byte_in;
 		//xsd__byte_Array byte_out;
-		xsd__short_Array short_out;
+		xsd__short_Array* short_out;
 		xsd__int_Array int_in;
-		xsd__int_Array int_out;
+		xsd__int_Array* int_out;
 		xsd__long_Array long_in;
-		xsd__long_Array long_out;
+		xsd__long_Array* long_out;
 		xsd__float_Array float_in;
-		xsd__float_Array float_out;
+		xsd__float_Array* float_out;
 		xsd__double_Array double_in;
-		xsd__double_Array double_out;
+		xsd__double_Array* double_out;
 		xsd__string_Array string_in;
-		xsd__string_Array string_out;
+		xsd__string_Array* string_out;
 
 
 		/* Test a boolean array */
-		boolean_in.m_Array = new xsd__boolean*[ARRAYSIZE];
-        xsd__boolean * booleanArray = new xsd__boolean[ARRAYSIZE];
-		boolean_in.m_Size = ARRAYSIZE;
-        int x = 0;
+		xsd__boolean ** booleanInArray = new xsd__boolean*[ARRAYSIZE];
+		int x = 0;
 		for (x=0; x<ARRAYSIZE; x++)
 		{
-            booleanArray[x] = (xsd__boolean)x;
-			boolean_in.m_Array[x] = &booleanArray[x];
+            booleanInArray[x] = new xsd__boolean((xsd__boolean)x);			
 		}
+		boolean_in.set(booleanInArray,ARRAYSIZE);
 		cout << "invoking echoBooleanArray..."<<endl;
-		boolean_out = ws.echoBooleanArray(boolean_in);
-		if(boolean_out.m_Size > 0)
-			if(*(boolean_out.m_Array[0]) == (xsd__boolean)0)
+		boolean_out = ws.echoBooleanArray(&boolean_in);
+		int outputSize=0;
+		const xsd__boolean ** booleanOutArray = boolean_out->get(outputSize);
+		if(outputSize > 0)
+			if(*( booleanOutArray[0]) == (xsd__boolean)0)
 				cout << "successful "<<endl;
 			else
 				cout << "failed "<<endl;		
 		else
-			cout << "failed "<<endl;		
+			cout << "failed "<<endl;
+
+		 // Clear up input array        
+        for (int deleteIndex = 0 ; deleteIndex < ARRAYSIZE ; deleteIndex++ )
+        {
+            delete booleanInArray[deleteIndex];
+        }
+        delete [] booleanInArray;
 
 		/* Test a byte array - that is directly rather than as base64Binary */
 		/*byte_in.m_Array = new xsd__byte[ARRAYSIZE];
@@ -114,93 +121,129 @@
 			cout << "failed "<<endl;		
                 */
 		/* Test an int array */
-		int_in.m_Array = new xsd__int*[ARRAYSIZE];
-        xsd__int * intArray = new xsd__int[ARRAYSIZE];
-		int_in.m_Size = ARRAYSIZE;
+		xsd__int ** intInArray = new xsd__int*[ARRAYSIZE];		
 		for (x=0; x<ARRAYSIZE; x++)
 		{
-            intArray[x] = x+1;
-			int_in.m_Array[x] = &intArray[x];
+            intInArray[x] = new xsd__int(x+1);
+			
 		}
+		int_in.set(intInArray,ARRAYSIZE);
 		cout << "invoking echoIntArray..."<<endl;
-		int_out = ws.echoIntArray(int_in);
-		if(int_out.m_Size > 0)
-			if(*(int_out.m_Array[0]) == 1)
+		int_out = ws.echoIntArray(&int_in);
+		outputSize = 0;
+		const xsd__int **intOutArray =int_out->get(outputSize);
+		if(outputSize > 0)
+			if(*(intOutArray[0]) == 1)
 				cout << "successful "<<endl;
 			else
 				cout << "failed "<<endl;		
 		else
 			cout << "failed "<<endl;
 
+		for (int deleteIndex = 0 ; deleteIndex < ARRAYSIZE ; deleteIndex++ )
+        {
+            delete intInArray[deleteIndex];
+        }
+        delete [] intInArray;
+
+
 		/* Test a long array */
-		long_in.m_Array = new xsd__long*[ARRAYSIZE];
-        xsd__long * longArray = new xsd__long[ARRAYSIZE];
-		long_in.m_Size = ARRAYSIZE;
+		xsd__long ** longInArray = new xsd__long*[ARRAYSIZE];        
 		for (x=0; x<ARRAYSIZE; x++)
 		{
-            longArray[x] = (xsd__long) x+ 200001;
-			long_in.m_Array[x] = &longArray[x];
+            longInArray[x] = new xsd__long(x+ 200001);
+			
 		}
+		long_in.set(longInArray,ARRAYSIZE);
 		cout << "invoking echoLongArray..."<<endl;
-		long_out = ws.echoLongArray(long_in);
-		if(long_out.m_Size > 0)
-			if(*(long_out.m_Array[0]) == (xsd__long)200001)
+		long_out = ws.echoLongArray(&long_in);
+		outputSize = 0;
+		const xsd__long **longOutArray = long_out->get(outputSize);
+		if(outputSize > 0)
+			if(*(longOutArray[0]) == (xsd__long)200001)
 				cout << "successful "<<endl;
 			else
 				cout << "failed "<<endl;		
 		else
 			cout << "failed "<<endl;		
 
+		// Clear up input array        
+        for (int deleteIndex = 0 ; deleteIndex < ARRAYSIZE ; deleteIndex++ )
+        {
+            delete longInArray[deleteIndex];
+        }
+        delete [] longInArray;
 
 		/* Test a float array */
-		float_in.m_Array = new xsd__float*[ARRAYSIZE];
-        xsd__float * floatArray = new xsd__float[ARRAYSIZE];
-		float_in.m_Size = ARRAYSIZE;
+		xsd__float **floatInArray = new xsd__float*[ARRAYSIZE];
+        
 		for (x=0; x<ARRAYSIZE; x++)
 		{
-            floatArray[x] = (xsd__float) x+ 11.111;
-			float_in.m_Array[x] = &floatArray[x];
+            floatInArray[x] = new xsd__float(x+ 11.111);
+			
 		}
+        float_in.set(floatInArray,ARRAYSIZE);
 		cout << "invoking echoFloatArray..."<<endl;
-		float_out = ws.echoFloatArray(float_in);
-		if(float_out.m_Size > 0)
-			if(*(float_out.m_Array[0]) == (xsd__float)11.111)
+		float_out = ws.echoFloatArray(&float_in);
+		outputSize =0;
+		const xsd__float **floatOutArray=float_out->get(outputSize);
+		if(outputSize > 0)
+			if(*(floatOutArray[0]) == (xsd__float)11.111)
 				cout << "successful "<<endl;
 			else
 				cout << "failed "<<endl;		
 		else
-			cout << "failed "<<endl;		
+			cout << "failed "<<endl;	
+
+		// Clear up input array        
+        for (int deleteIndex = 0 ; deleteIndex < ARRAYSIZE ; deleteIndex++ )
+        {
+            delete floatInArray[deleteIndex];
+        }
+        delete [] floatInArray;
 
 		/* Test a double array */
-		double_in.m_Array = new xsd__double*[ARRAYSIZE];
-        xsd__double * doubleArray = new xsd__double[ARRAYSIZE];
-		double_in.m_Size = ARRAYSIZE;
+		xsd__double ** doubleInArray=new xsd__double*[ARRAYSIZE];
+		
 		for (x=0; x<ARRAYSIZE; x++)
 		{
-            doubleArray[x] = (xsd__double)x+71.15656;
-			double_in.m_Array[x] = &doubleArray[x];
+            doubleInArray[x] = new xsd__double(x+71.15656);
+			
 		}
+		double_in.set(doubleInArray,ARRAYSIZE);
 		cout << "invoking echoDoubleArray..."<<endl;
-		double_out = ws.echoDoubleArray(double_in);
-		if(double_out.m_Size > 0)
-			if(*(double_out.m_Array[0]) == (xsd__double)71.15656)
+		double_out = ws.echoDoubleArray(&double_in);
+		outputSize = 0;
+		const xsd__double ** doubleOutArray = double_out->get(outputSize);
+
+		if(outputSize > 0)
+			if(*(doubleOutArray[0]) == (xsd__double)71.15656)
 				cout << "successful "<<endl;
 			else
 				cout << "failed "<<endl;		
 		else
-			cout << "failed "<<endl;		
+			cout << "failed "<<endl;	
+
+		// Clear up input array        
+        for (int deleteIndex = 0 ; deleteIndex < ARRAYSIZE ; deleteIndex++ )
+        {
+            delete doubleInArray[deleteIndex];
+        }
+        delete [] doubleInArray;
 
 		/* Test a string array */
 		static char* str1 = "Apache";
 		static char* str2 = "Axis C++";
-		string_in.m_Array = new xsd__string[ARRAYSIZE];
-		string_in.m_Size = ARRAYSIZE;
-		string_in.m_Array[0] = str1;
-		string_in.m_Array[1] = str2;
+		xsd__string * stringInArray = new xsd__string[ARRAYSIZE];		
+		stringInArray[0] = "Apache";
+		stringInArray[1] = "Axis C++";
+		string_in.set(stringInArray,ARRAYSIZE);
 		cout << "invoking echoStringArray..."<<endl;
-		string_out = ws.echoStringArray(string_in);
-		if(string_out.m_Size > 0)
-			if(strcmp(string_out.m_Array[0], str1) == 0)
+		string_out = ws.echoStringArray(&string_in);
+		outputSize =0;
+		const xsd__string * stringOutArray = string_out->get(outputSize);
+		if(outputSize > 0)
+			if(strcmp(stringOutArray[0], str1) == 0)
 				cout << "successful "<<endl;
 			else
 				cout << "failed "<<endl;