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/11 18:11:20 UTC
cvs commit: ws-axis/c/tests/auto_build/testcases/client/cpp AxisBenchClient.cpp ComplexListsClient.cpp NestedComplexClient.cpp
whitlock 2005/07/11 09:11:19
Modified: c/tests/auto_build/testcases/client/cpp AxisBenchClient.cpp
ComplexListsClient.cpp NestedComplexClient.cpp
Log:
Update AxisBench, ComplexLists and NestedComplex testcases to new storage pointed at by complex types so that the complex types' destructor can delete the storage.
Revision Changes Path
1.22 +0 -2 ws-axis/c/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp
Index: AxisBenchClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- AxisBenchClient.cpp 23 Mar 2005 15:45:06 -0000 1.21
+++ AxisBenchClient.cpp 11 Jul 2005 16:11:19 -0000 1.22
@@ -270,8 +270,6 @@
try
{
delete ws;
- for (int i = 0; i < input->infos.m_Size; i++)
- delete (BenchBasicDataType*)(input->infos.m_Array[i]);
delete input;
if (output)
{
1.6 +21 -20 ws-axis/c/tests/auto_build/testcases/client/cpp/ComplexListsClient.cpp
Index: ComplexListsClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/ComplexListsClient.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ComplexListsClient.cpp 23 Mar 2005 15:45:06 -0000 1.5
+++ ComplexListsClient.cpp 11 Jul 2005 16:11:19 -0000 1.6
@@ -30,6 +30,7 @@
#include <iostream>
#define ARRAYSIZE 2
+#define NEWCOPY(ptr,str) {ptr=new char[strlen(str)+1]; strcpy(ptr,str);}
using namespace std;
@@ -107,44 +108,44 @@
ComplexLists* ws = new ComplexLists(endpoint);
m_list ml; // xsd__string array
- m_list mlnp; // used for 1st namepair item of array
- m_list mlnp2; // used for 2nd namepair item of array
+ m_list *mlnp = new m_list; // used for 1st namepair item of array
+ m_list *mlnp2 = new m_list; // used for 2nd namepair item of array
attrlist al; // attrlist has namepair array
- namepair np1; // namepair has m_list and name
- namepair np2;
+ namepair *np1 = new namepair; // namepair has m_list and name
+ namepair *np2 = new namepair;
namepair_Array npArr;
// m_list arg to numtilist
ml.item.m_Array = new char*[ARRAYSIZE]; // make storage for array
ml.item.m_Size = ARRAYSIZE; // tell it how big it is
- ml.item.m_Array[0] = "never odd or even"; // should be returned in errortext element of attrlisterr
- ml.item.m_Array[1] = "any data string"; // add data
+ NEWCOPY(ml.item.m_Array[0], "never odd or even"); // should be returned in errortext element of attrlisterr
+ NEWCOPY(ml.item.m_Array[1], "any data string"); // add data
// To set into namepair item of namepair array of attrlist arg of multilist
- mlnp.item.m_Array = new char*[ARRAYSIZE];
- mlnp.item.m_Size = ARRAYSIZE;
- mlnp.item.m_Array[0] = "Apache";
- mlnp.item.m_Array[1] = "Axis C++";
+ mlnp->item.m_Array = new char*[ARRAYSIZE];
+ mlnp->item.m_Size = ARRAYSIZE;
+ NEWCOPY(mlnp->item.m_Array[0], "Apache");
+ NEWCOPY(mlnp->item.m_Array[1], "Axis C++");
// To set into namepair item of namepair array of attrlist arg of multilist
- mlnp2.item.m_Array = new char*[ARRAYSIZE];
- mlnp2.item.m_Size = ARRAYSIZE;
- mlnp2.item.m_Array[0] = "Test";
- mlnp2.item.m_Array[1] = "Complex";
+ mlnp2->item.m_Array = new char*[ARRAYSIZE];
+ mlnp2->item.m_Size = ARRAYSIZE;
+ NEWCOPY(mlnp2->item.m_Array[0], "Test");
+ NEWCOPY(mlnp2->item.m_Array[1], "Complex");
// set first namepair item to put into array
- np1.m_list_Ref = &mlnp;
- np1.name = "namepair1";
+ np1->m_list_Ref = mlnp;
+ NEWCOPY(np1->name, "namepair1");
// set second namepair item to put into array
- np2.m_list_Ref = &mlnp2;
- np2.name = "namepair2";
+ np2->m_list_Ref = mlnp2;
+ NEWCOPY(np2->name, "namepair2");
// create a namepair array to add into attrlist
npArr.m_Size=ARRAYSIZE;
npArr.m_Array = new namepair*[ARRAYSIZE];
- npArr.m_Array[0]=&np1;
- npArr.m_Array[1]=&np2;
+ npArr.m_Array[0]=np1;
+ npArr.m_Array[1]=np2;
// set attrlist argument
al.item = npArr;
1.4 +36 -36 ws-axis/c/tests/auto_build/testcases/client/cpp/NestedComplexClient.cpp
Index: NestedComplexClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/NestedComplexClient.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NestedComplexClient.cpp 23 Mar 2005 15:45:06 -0000 1.3
+++ NestedComplexClient.cpp 11 Jul 2005 16:11:19 -0000 1.4
@@ -42,6 +42,7 @@
#include <iostream>
#define ARRAYSIZE 2
+#define NEWCOPY(ptr,str) {ptr=new char[strlen(str)+1]; strcpy(ptr,str);}
int main(int argc, char* argv[])
{
@@ -58,42 +59,41 @@
ComplexType2 complexType2;
ComplexType2* response;
- xsd__string_Array strArray;
- xsd__int_Array intArray;
- SimpleArrays simpleArrays;
- ComplexType1 complexType1_1;
- ComplexType1 complexType1_2;
- ComplexType1_Array complexType1Array;
-
- strArray.m_Size = ARRAYSIZE;
- strArray.m_Array = new xsd__string[ARRAYSIZE];
- strArray.m_Array[0] = "Apache";
- strArray.m_Array[1] = "Axis C++";
-
- xsd__int * arrayOfInt = new xsd__int[ARRAYSIZE];
- intArray.m_Size = ARRAYSIZE;
- intArray.m_Array = new xsd__int*[ARRAYSIZE];
- arrayOfInt[0] = 6;
- intArray.m_Array[0] = &arrayOfInt[0];
- arrayOfInt[1] = 7;
- intArray.m_Array[1] = &arrayOfInt[1];
-
- simpleArrays.stringArray = strArray;
- simpleArrays.intArray = intArray;
-
- complexType1_1.simpleArrays = &simpleArrays;
- complexType1_1.ct1_string = "Hello";
- complexType1_1.ct1_int = 13;
- complexType1_2.simpleArrays = &simpleArrays;
- complexType1_2.ct1_string = "World";
- complexType1_2.ct1_int = 27;
-
- complexType1Array.m_Size = ARRAYSIZE;
- complexType1Array.m_Array = new ComplexType1*[ARRAYSIZE];
- complexType1Array.m_Array[0] = &complexType1_1;
- complexType1Array.m_Array[1] = &complexType1_2;
-
- complexType2.complexType1Array = complexType1Array;
+ 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);
+
+ strArray->m_Size = ARRAYSIZE;
+ strArray->m_Array = new xsd__string[ARRAYSIZE];
+ NEWCOPY(strArray->m_Array[0], "Apache");
+ NEWCOPY(strArray->m_Array[1], "Axis C++");
+
+ intArray->m_Size = ARRAYSIZE;
+ intArray->m_Array = new xsd__int*[ARRAYSIZE];
+ intArray->m_Array[0] = new int;
+ *(intArray->m_Array[0]) = 6;
+ intArray->m_Array[1] = new int;
+ *(intArray->m_Array[1]) = 7;
+ }
+
+ 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;
+
+ complexType2.complexType1Array.m_Size = ARRAYSIZE;
+ complexType2.complexType1Array.m_Array = new ComplexType1*[ARRAYSIZE];
+ complexType2.complexType1Array.m_Array[0] = complexType1_1;
+ complexType2.complexType1Array.m_Array[1] = complexType1_2;
response = ws.echoNestedComplex(&complexType2);
cout << response->complexType1Array.m_Array[0]->ct1_string << endl;