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/05/17 06:15:04 UTC
svn commit: r407148 - in
/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp:
NestedArraysClient.cpp NestedComplexClient.cpp NilValuesTestClient.cpp
NillableArraysClient.cpp
Author: nadiramra
Date: Tue May 16 21:15:03 2006
New Revision: 407148
URL: http://svn.apache.org/viewcvs?rev=407148&view=rev
Log:
C support fixes/enhancements. Cleanup C++ testcase for porting to C.
Modified:
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedArraysClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedComplexClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NilValuesTestClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NillableArraysClient.cpp
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedArraysClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedArraysClient.cpp?rev=407148&r1=407147&r2=407148&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedArraysClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedArraysClient.cpp Tue May 16 21:15:03 2006
@@ -13,6 +13,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE */
+/* ---------------------------------------------------------------- */
+/* CHANGES TO THIS FILE MAY ALSO REQUIRE CHANGES TO THE */
+/* C-EQUIVALENT FILE. PLEASE ENSURE THAT IT IS DONE. */
+/* ---------------------------------------------------------------- */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE */
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
#include "NestedArrays.hpp"
#include <axis/AxisException.hpp>
#include <iostream>
@@ -21,101 +30,116 @@
int main(int argc, char* argv[])
{
- char endpoint[256];
- const char* url="http://localhost:80/axis/NestedArrays";
+ NestedArrays* ws;
+
+
+ /* These contain xsd__int_Array */
+ ArrayOf_xsd_int baseArray1;
+ ArrayOf_xsd_int baseArray2;
+ ArrayOf_xsd_int baseArray3;
+ ArrayOf_xsd_int baseArray4;
+
+ /* These contain ArrayOf_xsd_int_Array */
+ ArrayOfArrayOf_xsd_int subArray1;
+ ArrayOfArrayOf_xsd_int subArray2;
+
+ /* This is an array of ArrayOfArrayOf_xsd_int */
+ ArrayOfArrayOf_xsd_int_Array parentArray;
+
+ xsd__int_Array baseArray1In;
+ xsd__int * baseArray1Vales[ARRAYSIZE];
+
+ xsd__int_Array baseArray2In;
+ xsd__int * baseArray2Vales[ARRAYSIZE];
+
+ xsd__int_Array baseArray3In;
+ xsd__int * baseArray3Vales[ARRAYSIZE];
+
+ xsd__int_Array baseArray4In;
+ xsd__int * baseArray4Vales[ARRAYSIZE];
+
+ ArrayOf_xsd_int_Array sarray1;
+ ArrayOf_xsd_int * array1[ARRAYSIZE];
+
+ ArrayOf_xsd_int_Array sarray2;
+ ArrayOf_xsd_int * array2[ARRAYSIZE];
- if(argc>1)
- url = argv[1];
+ ArrayOfArrayOf_xsd_int * pArray[ARRAYSIZE];
- try
- {
- sprintf(endpoint, "%s", url);
- NestedArrays* ws = new NestedArrays(endpoint);
-
- /* These contain xsd__int_Array */
- ArrayOf_xsd_int baseArray1;
- ArrayOf_xsd_int baseArray2;
- ArrayOf_xsd_int baseArray3;
- ArrayOf_xsd_int baseArray4;
-
- /* These contain ArrayOf_xsd_int_Array */
- ArrayOfArrayOf_xsd_int subArray1;
- ArrayOfArrayOf_xsd_int subArray2;
-
- /* This is an array of ArrayOfArrayOf_xsd_int */
- ArrayOfArrayOf_xsd_int_Array parentArray;
-
- /* Set xsd__int_Array into ArrayOf_xsd_int */
- xsd__int_Array baseArray1In;
- xsd__int ** baseArray1Vales = new xsd__int*[ARRAYSIZE];
- baseArray1Vales[0] = new xsd__int(1);
+ xsd__int_Array* response;
+ int outputSize = 0;
+ const xsd__int ** output;
+
+ char endpoint[256];
+ const char* url="http://localhost:80/axis/NestedArrays";
+
+ if(argc>1)
+ url = argv[1];
+
+ try
+ {
+ sprintf(endpoint, "%s", url);
+ ws = new NestedArrays(endpoint);
+
+ /* Set xsd__int_Array into ArrayOf_xsd_int */
+ baseArray1Vales[0] = new xsd__int(1);
baseArray1Vales[1] = new xsd__int(2);
- baseArray1In.set(baseArray1Vales,ARRAYSIZE);
- baseArray1.item= &baseArray1In;
+ baseArray1In.set(baseArray1Vales,ARRAYSIZE);
+ baseArray1.item= &baseArray1In;
- xsd__int_Array baseArray2In;
- xsd__int ** baseArray2Vales = new xsd__int*[ARRAYSIZE];
- baseArray2Vales[0] =new xsd__int(3);
+ baseArray2Vales[0] =new xsd__int(3);
baseArray2Vales[1] =new xsd__int(4);
- baseArray2In.set(baseArray2Vales,ARRAYSIZE);
- baseArray2.setitem(&baseArray2In);
-
- xsd__int_Array baseArray3In;
- xsd__int ** baseArray3Vales = new xsd__int*[ARRAYSIZE];
- baseArray3Vales[0] = new xsd__int(5);
+ baseArray2In.set(baseArray2Vales,ARRAYSIZE);
+ baseArray2.setitem(&baseArray2In);
+
+ baseArray3Vales[0] = new xsd__int(5);
baseArray3Vales[1] = new xsd__int(6);
- baseArray3In.set(baseArray3Vales,ARRAYSIZE);
- baseArray3.setitem(&baseArray3In);
-
- xsd__int_Array baseArray4In;
- xsd__int ** baseArray4Vales = new xsd__int*[ARRAYSIZE];
- baseArray4Vales[0] = new xsd__int(7);
+ baseArray3In.set(baseArray3Vales,ARRAYSIZE);
+ baseArray3.setitem(&baseArray3In);
+
+ baseArray4Vales[0] = new xsd__int(7);
baseArray4Vales[1] = new xsd__int(8);
- baseArray4In.set(baseArray4Vales,ARRAYSIZE);
- baseArray4.setitem(&baseArray4In);
-
-
- /* Set ArrayOf_xsd_int_Array into ArrayOfArrayOf_xsd_int */
- ArrayOf_xsd_int_Array sarray1;
- ArrayOf_xsd_int ** array1 = new ArrayOf_xsd_int*[ARRAYSIZE];
- array1[0] = &baseArray1;
- array1[1] = &baseArray2;
- sarray1.set(array1,ARRAYSIZE);
- subArray1.setitem(&sarray1);
-
- ArrayOf_xsd_int_Array sarray2;
- ArrayOf_xsd_int ** array2 = new ArrayOf_xsd_int*[ARRAYSIZE];
- array2[0] = &baseArray3;
- array2[1] = &baseArray4;
- sarray2.set(array2,ARRAYSIZE);
- subArray2.setitem(&sarray2);
-
- /* Set ArrayOfArrayOf_xsd_int into an Array of them */
-
- ArrayOfArrayOf_xsd_int ** pArray= new ArrayOfArrayOf_xsd_int*[ARRAYSIZE];
- pArray[0]=&subArray1;
- pArray[1]=&subArray2;
- parentArray.set(pArray,ARRAYSIZE);
- xsd__int_Array* response = ws->sendNestedArrays(&parentArray);
- int outputSize = 0;
- const xsd__int ** output = response->get(outputSize);
- cout << *(output[0]) << " " << *(output[1]) << endl;
- delete ws;
- }
- catch(AxisException& e)
- {
- cout << "Exception : " << e.what() << endl;
- }
- catch(exception& e)
- {
- cout << "Unknown exception has occured" << endl;
- }
- catch(...)
- {
- cout << "Unknown exception has occured" << endl;
- }
- cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
+ baseArray4In.set(baseArray4Vales,ARRAYSIZE);
+ baseArray4.setitem(&baseArray4In);
+
+ /* Set ArrayOf_xsd_int_Array into ArrayOfArrayOf_xsd_int */
+ array1[0] = &baseArray1;
+ array1[1] = &baseArray2;
+ sarray1.set(array1,ARRAYSIZE);
+ subArray1.setitem(&sarray1);
+
+ array2[0] = &baseArray3;
+ array2[1] = &baseArray4;
+ sarray2.set(array2,ARRAYSIZE);
+ subArray2.setitem(&sarray2);
+
+ /* Set ArrayOfArrayOf_xsd_int into an Array of them */
+
+ pArray[0]=&subArray1;
+ pArray[1]=&subArray2;
+ parentArray.set(pArray,ARRAYSIZE);
+
+ response = ws->sendNestedArrays(&parentArray);
- return 0;
+ output = response->get(outputSize);
+ cout << *(output[0]) << " " << *(output[1]) << endl;
+
+ delete ws;
+ }
+ catch(AxisException& e)
+ {
+ cout << "Exception : " << e.what() << endl;
+ }
+ catch(exception& e)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+ catch(...)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+ cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
+
+ return 0;
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedComplexClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedComplexClient.cpp?rev=407148&r1=407147&r2=407148&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedComplexClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NestedComplexClient.cpp Tue May 16 21:15:03 2006
@@ -37,6 +37,16 @@
*
*/
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE */
+/* ---------------------------------------------------------------- */
+/* CHANGES TO THIS FILE MAY ALSO REQUIRE CHANGES TO THE */
+/* C-EQUIVALENT FILE. PLEASE ENSURE THAT IT IS DONE. */
+/* ---------------------------------------------------------------- */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE */
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+
#include "NestedComplex.hpp"
#include <axis/AxisException.hpp>
#include <iostream>
@@ -46,94 +56,94 @@
int main(int argc, char* argv[])
{
- char endpoint[256];
- const char* url="http://localhost:80/axis/NestedComplex";
+ char endpoint[256];
+ const char* url="http://localhost:80/axis/NestedComplex";
- if(argc>1)
- url = argv[1];
+ if(argc>1)
+ url = argv[1];
- try
+ try
+ {
+ sprintf(endpoint, "%s", url);
+ NestedComplex ws(endpoint);
+
+ ComplexType2 complexType2;
+ ComplexType2* response;
+ SimpleArrays *simpleArrays1 = new SimpleArrays;
+ SimpleArrays *simpleArrays2 = new SimpleArrays;
+ SimpleArrays *simpleArrays[2] = {simpleArrays1, simpleArrays2};
+ ComplexType1 *complexType1_1 = new ComplexType1;
+ ComplexType1 *complexType1_2 = new ComplexType1;
+
+ for (int i=0; i<2; i++)
{
- sprintf(endpoint, "%s", url);
- NestedComplex ws(endpoint);
+ xsd__string_Array *strArray = simpleArrays[i]->stringArray;
+ xsd__int_Array *intArray = simpleArrays[i]->intArray;
+ xsd__string strType[ARRAYSIZE];
+ xsd__int * intType[ARRAYSIZE];
+ NEWCOPY(strType[0], "Apache");
+ NEWCOPY(strType[1], "Axis C++");
+ strArray->set(strType,ARRAYSIZE);
+ intType[0] = new int(6);
+ intType[1] = new int(7);
+ intArray->set(intType,ARRAYSIZE);
+ delete intType[0];
+ delete intType[1];
+ delete strType[0];
+ delete strType[1];
- ComplexType2 complexType2;
- ComplexType2* response;
- SimpleArrays *simpleArrays1 = new SimpleArrays;
- SimpleArrays *simpleArrays2 = new SimpleArrays;
- SimpleArrays *simpleArrays[2] = {simpleArrays1, simpleArrays2};
- ComplexType1 *complexType1_1 = new ComplexType1;
- ComplexType1 *complexType1_2 = new ComplexType1;
-
- for (int i=0; i<2; i++)
- {
- xsd__string_Array *strArray = simpleArrays[i]->stringArray;
- xsd__int_Array *intArray = simpleArrays[i]->intArray;
- xsd__string *strType = new xsd__string[ARRAYSIZE];
- xsd__int ** intType = new xsd__int*[ARRAYSIZE];
- NEWCOPY(strType[0], "Apache");
- NEWCOPY(strType[1], "Axis C++");
- strArray->set(strType,ARRAYSIZE);
- intType[0] = new int(6);
- intType[1] = new int(7);
- intArray->set(intType,ARRAYSIZE);
- delete intType[0];
- delete intType[1];
- delete [] intType;
- delete strType[0];
- delete strType[1];
- delete [] strType;
-
- }
-
- complexType1_1->simpleArrays = simpleArrays1;
- NEWCOPY(complexType1_1->ct1_string, "Hello");
- complexType1_1->ct1_int = 13;
- complexType1_2->simpleArrays = simpleArrays2;
- NEWCOPY(complexType1_2->ct1_string, "World");
- complexType1_2->ct1_int = 27;
+ }
+ complexType1_1->simpleArrays = simpleArrays1;
+ NEWCOPY(complexType1_1->ct1_string, "Hello");
+ complexType1_1->ct1_int = 13;
+ complexType1_2->simpleArrays = simpleArrays2;
+ NEWCOPY(complexType1_2->ct1_string, "World");
+ complexType1_2->ct1_int = 27;
+
+
+ ComplexType1_Array cType1Array;
+ ComplexType1 * array[ARRAYSIZE];
+ array[0]= complexType1_1;
+ array[1] = complexType1_2;
+ cType1Array.set(array,ARRAYSIZE);
+ complexType2.setcomplexType1Array(&cType1Array);
+ delete array[0];
+ delete array[1];
- ComplexType1_Array cType1Array;
- ComplexType1 ** array = new ComplexType1*[ARRAYSIZE];
- array[0]= complexType1_1;
- array[1] = complexType1_2;
- cType1Array.set(array,ARRAYSIZE);
- complexType2.setcomplexType1Array(&cType1Array);
- delete array[0];
- delete array[1];
- delete []array;
- response = ws.echoNestedComplex(&complexType2);
- int outputSize =0;
- ComplexType1 ** output = response->getcomplexType1Array()->get(outputSize);
- cout << output[0]->ct1_string << endl;
- cout << output[0]->ct1_int << endl;
- cout << output[0]->simpleArrays->stringArray->get(outputSize)[0] << " ";
- cout << output[0]->simpleArrays->stringArray->get(outputSize)[1] << endl;
- cout << *(output[0]->simpleArrays->intArray->get(outputSize)[0]) << " ";
- cout << *(output[0]->simpleArrays->intArray->get(outputSize)[1]) << endl;
- cout << output[1]->ct1_string << endl;
- cout << output[1]->ct1_int << endl;
- cout << output[1]->simpleArrays->stringArray->get(outputSize)[0] << " ";
- cout << output[1]->simpleArrays->stringArray->get(outputSize)[1] << endl;
- cout << *(output[1]->simpleArrays->intArray->get(outputSize)[0]) << " ";
- cout << *(output[1]->simpleArrays->intArray->get(outputSize)[1]) << endl;
-
- }
- catch(AxisException& e)
- {
- cout << "Exception : " << e.what() << endl;
- }
- catch(exception& e)
- {
- cout << "Unknown exception has occured : " << e.what() << endl;
- }
- catch(...)
- {
- cout << "Unknown exception has occured" << endl;
- }
- cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
+ response = ws.echoNestedComplex(&complexType2);
+ int outputSize =0;
+
+ ComplexType1 ** output = response->getcomplexType1Array()->get(outputSize);
+
+ cout << output[0]->ct1_string << endl;
+ cout << output[0]->ct1_int << endl;
+ cout << output[0]->simpleArrays->stringArray->get(outputSize)[0] << " ";
+ cout << output[0]->simpleArrays->stringArray->get(outputSize)[1] << endl;
+ cout << *(output[0]->simpleArrays->intArray->get(outputSize)[0]) << " ";
+ cout << *(output[0]->simpleArrays->intArray->get(outputSize)[1]) << endl;
+ cout << output[1]->ct1_string << endl;
+ cout << output[1]->ct1_int << endl;
+ cout << output[1]->simpleArrays->stringArray->get(outputSize)[0] << " ";
+ cout << output[1]->simpleArrays->stringArray->get(outputSize)[1] << endl;
+ cout << *(output[1]->simpleArrays->intArray->get(outputSize)[0]) << " ";
+ cout << *(output[1]->simpleArrays->intArray->get(outputSize)[1]) << endl;
+
+ }
+ catch(AxisException& e)
+ {
+ cout << "Exception : " << e.what() << endl;
+ }
+ catch(exception& e)
+ {
+ cout << "Unknown exception has occured : " << e.what() << endl;
+ }
+ catch(...)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+ cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
- return 0;
+ return 0;
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NilValuesTestClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NilValuesTestClient.cpp?rev=407148&r1=407147&r2=407148&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NilValuesTestClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NilValuesTestClient.cpp Tue May 16 21:15:03 2006
@@ -13,6 +13,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE */
+/* ---------------------------------------------------------------- */
+/* CHANGES TO THIS FILE MAY ALSO REQUIRE CHANGES TO THE */
+/* C-EQUIVALENT FILE. PLEASE ENSURE THAT IT IS DONE. */
+/* ---------------------------------------------------------------- */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE */
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+
#include <axis/AxisException.hpp>
#include "operations.hpp"
@@ -31,81 +41,83 @@
void setLogOptions(const char *output_filename);
int main(int argc, char* argv[])
-{
- operations *ws;
+{
+ operations *ws;
- char *endpoint = WSDL_DEFAULT_ENDPOINT;
- bool endpoint_set = false;
- int returnValue = 1; // Assume Failure
-
- endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
-
- bool bSuccess = false;
- int iRetryIterationCount = 3;
-
- do
- {
- try {
- if(endpoint_set) {
- ws = new operations(endpoint, APTHTTP1_1);
- free(endpoint);
- endpoint_set = false;
- } else
- ws = new operations();
-
- aRecord* input = new aRecord();
- xsd__boolean result = (xsd__boolean)0;
- result = ws->myOperation(input);
-
- cout << "Result " << result << endl;
-
- returnValue = 0; // Success
-
- bSuccess = true;
-
- } catch(AxisException &e) {
- bool bSilent = false;
-
- if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
- {
- if( iRetryIterationCount > 0)
- {
- bSilent = true;
- }
- }
- else
- {
- iRetryIterationCount = 0;
- }
+ char *endpoint = WSDL_DEFAULT_ENDPOINT;
+ bool endpoint_set = false;
+ int returnValue = 1; // Assume Failure
+
+ endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
+
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
+
+ do
+ {
+ try
+ {
+ if(endpoint_set)
+ {
+ ws = new operations(endpoint, APTHTTP1_1);
+ free(endpoint);
+ endpoint_set = false;
+ }
+ else
+ ws = new operations();
+
+ aRecord* input = new aRecord();
+ xsd__boolean result = (xsd__boolean)0;
+ result = ws->myOperation(input);
+
+ cout << "Result " << result << endl;
+
+ returnValue = 0; // Success
+
+ 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(...) {
- cout << "Unknown Exception occured." << endl;
- }
- iRetryIterationCount--;
- } while( iRetryIterationCount > 0 && !bSuccess);
-
- if( endpoint_set)
- free(endpoint);
- // Samisa : clean up memory allocated for stub
- try
- {
- delete ws;
- }
- catch(exception& exception)
- {
- cout << "Exception on clean up of ws : " << exception.what()<<endl;
- }
- catch(...)
- {
- cout << "Unknown exception on clean up of ws : " << endl;
- }
- cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+ cout << "Exception : " << e.what() << endl;
+ }
+ catch(...)
+ {
+ cout << "Unknown Exception occured." << endl;
+ }
+ iRetryIterationCount--;
+ }
+ while( iRetryIterationCount > 0 && !bSuccess);
+
+ if( endpoint_set)
+ free(endpoint);
+
+ try
+ {
+ delete ws;
+ }
+ catch(exception& exception)
+ {
+ cout << "Exception on clean up of ws : " << exception.what()<<endl;
+ }
+ catch(...)
+ {
+ cout << "Unknown exception on clean up of ws : " << endl;
+ }
+ cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
- return returnValue;
+ return returnValue;
}
/* Spin through args list and check for -e -p and -s options.
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NillableArraysClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NillableArraysClient.cpp?rev=407148&r1=407147&r2=407148&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NillableArraysClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/NillableArraysClient.cpp Tue May 16 21:15:03 2006
@@ -18,6 +18,14 @@
* This is for primitive types only
*/
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE */
+/* ---------------------------------------------------------------- */
+/* CHANGES TO THIS FILE MAY ALSO REQUIRE CHANGES TO THE */
+/* C-EQUIVALENT FILE. PLEASE ENSURE THAT IT IS DONE. */
+/* ---------------------------------------------------------------- */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE */
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
#include "NillableArrays.hpp"
#include <axis/AxisException.hpp>
@@ -29,280 +37,226 @@
int main(int argc, char* argv[])
{
- const char* url="http://localhost:80/axis/NillableArrays";
- char endpoint[256];
+ const char* url="http://localhost:80/axis/NillableArrays";
+ char endpoint[256];
- if(argc>1)
- url = argv[1];
+ if(argc>1)
+ url = argv[1];
- try
+ try
+ {
+ int outputSize = 0;
+ sprintf(endpoint, "%s", url);
+ NillableArrays ws(endpoint);
+
+ xsd__boolean_Array boolean_in;
+ xsd__boolean_Array* boolean_out;
+ xsd__short_Array short_in;
+ xsd__short_Array* short_out;
+ xsd__int_Array int_in;
+ xsd__int_Array* int_out;
+ xsd__long_Array long_in;
+ xsd__long_Array* long_out;
+ xsd__float_Array float_in;
+ xsd__float_Array* float_out;
+ xsd__double_Array double_in;
+ xsd__double_Array* double_out;
+ xsd__string_Array string_in;
+ xsd__string_Array* string_out;
+
+
+ /* Test a boolean array */
+ xsd__boolean b1 = (xsd__boolean)0;
+ xsd__boolean b3 = (xsd__boolean)1;
+ xsd__boolean **booleanInArray = new xsd__boolean*[ARRAYSIZE];
+ booleanInArray[0] = &b1;
+ booleanInArray[1] = NULL;
+ booleanInArray[2] = &b3;
+ boolean_in.set(booleanInArray,ARRAYSIZE);
+ cout << "invoking echoBooleanArray..."<<endl;
+ boolean_out = ws.echoBooleanArray(&boolean_in);
+
+ outputSize = 0;
+ const xsd__boolean ** booleanArray = boolean_out->get(outputSize);
+ if(outputSize ==ARRAYSIZE)
{
- int outputSize = 0;
- sprintf(endpoint, "%s", url);
- NillableArrays ws(endpoint);
-
- xsd__boolean_Array boolean_in;
- xsd__boolean_Array* boolean_out;
- xsd__short_Array short_in;
- xsd__short_Array* short_out;
- xsd__int_Array int_in;
- xsd__int_Array* int_out;
- xsd__long_Array long_in;
- xsd__long_Array* long_out;
- xsd__float_Array float_in;
- xsd__float_Array* float_out;
- xsd__double_Array double_in;
- xsd__double_Array* double_out;
- xsd__string_Array string_in;
- xsd__string_Array* string_out;
-
-
- /* Test a boolean array */
- xsd__boolean b1 = (xsd__boolean)0;
- xsd__boolean b3 = (xsd__boolean)1;
- xsd__boolean **booleanInArray = new xsd__boolean*[ARRAYSIZE];
- booleanInArray[0] = &b1;
- booleanInArray[1] = NULL;
- booleanInArray[2] = &b3;
- boolean_in.set(booleanInArray,ARRAYSIZE);
- cout << "invoking echoBooleanArray..."<<endl;
- boolean_out = ws.echoBooleanArray(&boolean_in);
-
- outputSize = 0;
- const xsd__boolean ** booleanArray = boolean_out->get(outputSize);
- if(outputSize ==ARRAYSIZE)
- {
- if(booleanArray[1])
- {
- cout << "failed "<<endl;
- }
- else if( (*booleanArray[0] == b1) && (*booleanArray[2] == b3) )
- {
- cout << "successful "<<endl;
- }
- else
- {
- cout << "failed "<<endl;
- }
- }
- else
- {
- cout << "failed "<<endl;
- }
-
- /* Test an short array */
- xsd__short s1 = (xsd__short)252;
- xsd__short s3 = (xsd__short)254;
- xsd__short ** shortInArray = new xsd__short*[ARRAYSIZE];
- shortInArray[0] = &s1;
- shortInArray[1] = NULL;
- shortInArray[2] = &s3;
- short_in.set(shortInArray,ARRAYSIZE);
- cout << "invoking echoShortArray..."<<endl;
- short_out = ws.echoShortArray(&short_in);
-
- outputSize = 0;
- const xsd__short ** shortArray = short_out->get(outputSize);
- if(outputSize ==ARRAYSIZE)
- {
- if(shortArray[1])
- {
- cout << "failed "<<endl;
- }
- else if( (*shortArray[0] == s1) && (*shortArray[2] == s3) )
- {
- cout << "successful "<<endl;
- }
- else
- {
- cout << "failed "<<endl;
- }
- }
- else
- {
- cout << "failed "<<endl;
- }
-
- /* Test an int array */
- xsd__int val1 = 1000000;
- xsd__int val3 = 1000002;
- xsd__int ** intInArray = new xsd__int*[ARRAYSIZE];
- intInArray[0] = &val1;
- intInArray[1] = NULL;
- intInArray[2] = &val3;
- int_in.set(intInArray,ARRAYSIZE);
- cout << "invoking echoIntArray..."<<endl;
- int_out = ws.echoIntArray(&int_in);
-
- outputSize = 0;
- const xsd__int ** intArray = int_out->get(outputSize);
- if(outputSize ==ARRAYSIZE)
- {
- if(intArray[1])
- {
- cout << "failed "<<endl;
- }
- else if( (*intArray[0] == val1) && (*intArray[2] == val3) )
- {
- cout << "successful "<<endl;
- }
- else
- {
- cout << "failed "<<endl;
- }
- }
- else
- {
- cout << "failed "<<endl;
- }
-
-
- /* Test a long array */
- xsd__long l1 = (xsd__long)200001;
- xsd__long l3 = (xsd__long)200003;
- xsd__long ** longInArray = new xsd__long*[ARRAYSIZE];
- longInArray[0] = &l1;
- longInArray[1] = NULL;
- longInArray[2] = &l3;
- long_in.set(longInArray,ARRAYSIZE);
- cout << "invoking echoLongArray..."<<endl;
- long_out = ws.echoLongArray(&long_in);
-
- outputSize = 0;
- const xsd__long ** longArray = long_out->get(outputSize);
- if(outputSize ==ARRAYSIZE)
- {
- if(longArray[1])
- {
- cout << "failed "<<endl;
- }
- else if( (*longArray[0] == l1) && (*longArray[2] == l3) )
- {
- cout << "successful "<<endl;
- }
- else
- {
- cout << "failed "<<endl;
- }
- }
- else
- {
- cout << "failed "<<endl;
- }
-
- /* Test a float array */
- xsd__float f1 = (xsd__float)11.111;
- xsd__float f3 = (xsd__float)33.111;
- xsd__float **floatInArray = new xsd__float*[ARRAYSIZE];
- floatInArray[0] = &f1;
- floatInArray[1] = NULL;
- floatInArray[2] = &f3;
- float_in.set(floatInArray,ARRAYSIZE);
- cout << "invoking echoFloatArray..."<<endl;
- float_out = ws.echoFloatArray(&float_in);
-
- outputSize = 0;
- const xsd__float ** floatArray = float_out->get(outputSize);
- if(outputSize ==ARRAYSIZE)
- {
- if(floatArray[1])
- {
- cout << "failed "<<endl;
- }
- else if( (*floatArray[0] == f1) && (*floatArray[2] == f3) )
- {
- cout << "successful "<<endl;
- }
- else
- {
- cout << "failed "<<endl;
- }
- }
- else
- {
- cout << "failed "<<endl;
- }
-
- /* Test a double array */
- xsd__double d1 = (xsd__double)71.1565;
- xsd__double d3 = (xsd__double)73.1565;
-
- xsd__double ** doubleInArray = new xsd__double*[ARRAYSIZE];
- doubleInArray[0] = &d1;
- doubleInArray[1] = NULL;
- doubleInArray[2] = &d3;
- double_in.set(doubleInArray,ARRAYSIZE);
- cout << "invoking echoDoubleArray..."<<endl;
- double_out = ws.echoDoubleArray(&double_in);
-
- outputSize = 0;
- const xsd__double ** doubleArray = double_out->get(outputSize);
- if(outputSize ==ARRAYSIZE)
- {
- if(doubleArray[1])
- {
- cout << "failed "<<endl;
- }
- else if( (*doubleArray[0] == d1) && (*doubleArray[2] == d3) )
- {
- cout << "successful "<<endl;
- }
- else
- {
- cout << "failed "<<endl;
- }
- }
- else
- {
- cout << "failed "<<endl;
- }
-
- /* Test a string array */
- static char* str1 = "Apache";
- static char* str2 = "Axis C++";
- xsd__string * stringInArray = new xsd__string[ARRAYSIZE];
- stringInArray[0] = str1;
- stringInArray[1] = NULL;
- stringInArray[2] = str2;
- string_in.set(stringInArray,ARRAYSIZE);
- cout << "invoking echoStringArray..."<<endl;
- string_out = ws.echoStringArray(&string_in);
- outputSize =0;
- const xsd__string *output = string_out->get(outputSize);
- if(outputSize ==ARRAYSIZE)
- {
- if(output[1])
- {
- cout << "failed "<<endl;
- }
- else if( (strcmp(output[0], str1) == 0) && (strcmp(output[2], str2) == 0) )
- {
- cout << "successful "<<endl;
- }
- else
- {
- cout << "failed "<<endl;
- }
- }
- else
- {
- cout << "failed "<<endl;
- }
+ if(booleanArray[1])
+ cout << "failed "<<endl;
+ else if( (*booleanArray[0] == b1) && (*booleanArray[2] == b3) )
+ cout << "successful "<<endl;
+ else
+ cout << "failed "<<endl;
+ }
+ else
+ cout << "failed "<<endl;
+ /* Test an short array */
+ xsd__short s1 = (xsd__short)252;
+ xsd__short s3 = (xsd__short)254;
+ xsd__short ** shortInArray = new xsd__short*[ARRAYSIZE];
+ shortInArray[0] = &s1;
+ shortInArray[1] = NULL;
+ shortInArray[2] = &s3;
+ short_in.set(shortInArray,ARRAYSIZE);
+ cout << "invoking echoShortArray..."<<endl;
+ short_out = ws.echoShortArray(&short_in);
+
+ outputSize = 0;
+ const xsd__short ** shortArray = short_out->get(outputSize);
+ if(outputSize ==ARRAYSIZE)
+ {
+ if(shortArray[1])
+ cout << "failed "<<endl;
+ else if( (*shortArray[0] == s1) && (*shortArray[2] == s3) )
+ cout << "successful "<<endl;
+ else
+ cout << "failed "<<endl;
}
- catch(AxisException& e)
+ else
+ cout << "failed "<<endl;
+
+ /* Test an int array */
+ xsd__int val1 = 1000000;
+ xsd__int val3 = 1000002;
+ xsd__int ** intInArray = new xsd__int*[ARRAYSIZE];
+ intInArray[0] = &val1;
+ intInArray[1] = NULL;
+ intInArray[2] = &val3;
+ int_in.set(intInArray,ARRAYSIZE);
+ cout << "invoking echoIntArray..."<<endl;
+ int_out = ws.echoIntArray(&int_in);
+
+ outputSize = 0;
+ const xsd__int ** intArray = int_out->get(outputSize);
+ if(outputSize ==ARRAYSIZE)
{
- cout << "Exception : "<< e.what()<<endl;
+ if(intArray[1])
+ cout << "failed "<<endl;
+ else if( (*intArray[0] == val1) && (*intArray[2] == val3) )
+ cout << "successful "<<endl;
+ else
+ cout << "failed "<<endl;
}
- catch(exception& e)
+ else
+ cout << "failed "<<endl;
+
+
+ /* Test a long array */
+ xsd__long l1 = (xsd__long)200001;
+ xsd__long l3 = (xsd__long)200003;
+ xsd__long ** longInArray = new xsd__long*[ARRAYSIZE];
+ longInArray[0] = &l1;
+ longInArray[1] = NULL;
+ longInArray[2] = &l3;
+ long_in.set(longInArray,ARRAYSIZE);
+ cout << "invoking echoLongArray..."<<endl;
+ long_out = ws.echoLongArray(&long_in);
+
+ outputSize = 0;
+ const xsd__long ** longArray = long_out->get(outputSize);
+ if(outputSize ==ARRAYSIZE)
{
- cout << "Unknown exception has occured"<<endl;
+ if(longArray[1])
+ cout << "failed "<<endl;
+ else if( (*longArray[0] == l1) && (*longArray[2] == l3) )
+ cout << "successful "<<endl;
+ else
+ cout << "failed "<<endl;
}
- catch(...)
+ else
+ cout << "failed "<<endl;
+
+ /* Test a float array */
+ xsd__float f1 = (xsd__float)11.111;
+ xsd__float f3 = (xsd__float)33.111;
+ xsd__float **floatInArray = new xsd__float*[ARRAYSIZE];
+ floatInArray[0] = &f1;
+ floatInArray[1] = NULL;
+ floatInArray[2] = &f3;
+ float_in.set(floatInArray,ARRAYSIZE);
+ cout << "invoking echoFloatArray..."<<endl;
+ float_out = ws.echoFloatArray(&float_in);
+
+ outputSize = 0;
+ const xsd__float ** floatArray = float_out->get(outputSize);
+ if(outputSize ==ARRAYSIZE)
{
- cout << "Unknown exception has occured"<<endl;
+ if(floatArray[1])
+ cout << "failed "<<endl;
+ else if( (*floatArray[0] == f1) && (*floatArray[2] == f3) )
+ cout << "successful "<<endl;
+ else
+ cout << "failed "<<endl;
}
- cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
- return 0;
+ else
+ cout << "failed "<<endl;
+
+ /* Test a double array */
+ xsd__double d1 = (xsd__double)71.1565;
+ xsd__double d3 = (xsd__double)73.1565;
+
+ xsd__double ** doubleInArray = new xsd__double*[ARRAYSIZE];
+ doubleInArray[0] = &d1;
+ doubleInArray[1] = NULL;
+ doubleInArray[2] = &d3;
+ double_in.set(doubleInArray,ARRAYSIZE);
+ cout << "invoking echoDoubleArray..."<<endl;
+ double_out = ws.echoDoubleArray(&double_in);
+
+ outputSize = 0;
+ const xsd__double ** doubleArray = double_out->get(outputSize);
+ if(outputSize ==ARRAYSIZE)
+ {
+ if(doubleArray[1])
+ cout << "failed "<<endl;
+ else if( (*doubleArray[0] == d1) && (*doubleArray[2] == d3) )
+ cout << "successful "<<endl;
+ else
+ cout << "failed "<<endl;
+ }
+ else
+ cout << "failed "<<endl;
+
+ /* Test a string array */
+ static char* str1 = "Apache";
+ static char* str2 = "Axis C++";
+ xsd__string * stringInArray = new xsd__string[ARRAYSIZE];
+ stringInArray[0] = str1;
+ stringInArray[1] = NULL;
+ stringInArray[2] = str2;
+ string_in.set(stringInArray,ARRAYSIZE);
+ cout << "invoking echoStringArray..."<<endl;
+ string_out = ws.echoStringArray(&string_in);
+ outputSize =0;
+ const xsd__string *output = string_out->get(outputSize);
+ if(outputSize ==ARRAYSIZE)
+ {
+ if(output[1])
+ cout << "failed "<<endl;
+ else if( (strcmp(output[0], str1) == 0) && (strcmp(output[2], str2) == 0) )
+ cout << "successful "<<endl;
+ else
+ cout << "failed "<<endl;
+ }
+ else
+ cout << "failed "<<endl;
+
+ }
+ catch(AxisException& e)
+ {
+ cout << "Exception : "<< e.what()<<endl;
+ }
+ catch(exception& e)
+ {
+ cout << "Unknown exception has occured"<<endl;
+ }
+ catch(...)
+ {
+ cout << "Unknown exception has occured"<<endl;
+ }
+
+ cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+
+ return 0;
}