axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From perr...@apache.org
Subject cvs commit: ws-axis/c/tests/auto_build/testcases/tests NestedArrays.xml NestedComplex.xml PrimitiveAndArray.xml
Date Mon, 21 Mar 2005 14:52:35 GMT
perryan     2005/03/21 06:52:35

  Added:       c/tests/auto_build/testcases/client/cpp
                        NestedArraysClient.cpp NestedComplexClient.cpp
                        PrimitiveAndArrayClient.cpp
               c/tests/auto_build/testcases/output NestedArrays.expected
                        NestedComplex.expected PrimitiveAndArray.expected
               c/tests/auto_build/testcases/tests NestedArrays.xml
                        NestedComplex.xml PrimitiveAndArray.xml
  Log:
  Added 3 new tests to cover a mixture of complex types with arrays and sub-complex types,
and mixing arrays with primitives.
  
  Revision  Changes    Path
  1.1                  ws-axis/c/tests/auto_build/testcases/client/cpp/NestedArraysClient.cpp
  
  Index: NestedArraysClient.cpp
  ===================================================================
  #include "NestedArrays.hpp"
  #include <axis/AxisException.hpp>
  #include <iostream>
  
  #define ARRAYSIZE 2
  
  int main(int argc, char* argv[])
  {
  	char endpoint[256];
  	const char* url="http://localhost:80/axis/NestedArrays";
  
  	if(argc>1)
  		url = argv[1];
  
  	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 */
  		baseArray1.item.m_Array = new xsd__int[ARRAYSIZE];
  		baseArray1.item.m_Size = ARRAYSIZE;
  		baseArray1.item.m_Array[0] = 1;
  		baseArray1.item.m_Array[1] = 2;
  
  		baseArray2.item.m_Array = new xsd__int[ARRAYSIZE];
  		baseArray2.item.m_Size = ARRAYSIZE;
  		baseArray2.item.m_Array[0] = 3;
  		baseArray2.item.m_Array[1] = 4;
  
  		baseArray3.item.m_Array = new xsd__int[ARRAYSIZE];
  		baseArray3.item.m_Size = ARRAYSIZE;
  		baseArray3.item.m_Array[0] = 5;
  		baseArray3.item.m_Array[1] = 6;
  
  		baseArray4.item.m_Array = new xsd__int[ARRAYSIZE];
  		baseArray4.item.m_Size = ARRAYSIZE;
  		baseArray4.item.m_Array[0] = 7;
  		baseArray4.item.m_Array[1] = 8;
  
  		/* Set ArrayOf_xsd_int_Array into ArrayOfArrayOf_xsd_int */
  		subArray1.item.m_Array = new ArrayOf_xsd_int[ARRAYSIZE];
  		subArray1.item.m_Size = ARRAYSIZE;
  		subArray1.item.m_Array[0] = baseArray1;
  		subArray1.item.m_Array[1] = baseArray2;
  
  		subArray2.item.m_Array = new ArrayOf_xsd_int[ARRAYSIZE];
  		subArray2.item.m_Size = ARRAYSIZE;
  		subArray2.item.m_Array[0] = baseArray3;
  		subArray2.item.m_Array[1] = baseArray4;
  
  		/* Set ArrayOfArrayOf_xsd_int into an Array of them */
  		parentArray.m_Array = new ArrayOfArrayOf_xsd_int[ARRAYSIZE];
  		parentArray.m_Size = ARRAYSIZE;
  		parentArray.m_Array[0] = subArray1;
  		parentArray.m_Array[1] = subArray2;
  
  		xsd__int_Array response = ws->sendNestedArrays(parentArray);
  
  		cout << response.m_Array[0] << " " << response.m_Array[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;
  }
  
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/cpp/NestedComplexClient.cpp
  
  Index: NestedComplexClient.cpp
  ===================================================================
  
  /*
   * NestedComplex
   * 
   * Send a complex data type, ComplexType2, which has a data element of an
   * array of a complex data type, ComplexType1. The ComplexType1 data type
   * has a xsd:string element, a xsd:int element and a complex data type element
   * SimpleArrays. The SimpleArrays complex data type has a xsd:string array and
   * a xsd_int array.
   *
   * ComplexType2
   *   + ComplexType1[]
   *       + string
   *       + int
   *       + SimpleArrays
   *           + string[]
   *           + int[]
   *
   * This is an echo type service so the response should be the same as the request.
   *
   * Author: Andrew Perry
   *
   */
  
  #include "NestedComplex.hpp"
  #include <axis/AxisException.hpp>
  #include <iostream>
  
  #define ARRAYSIZE 2
  
  int main(int argc, char* argv[])
  {
  	char endpoint[256];
  	const char* url="http://localhost:80/axis/NestedComplex";
  
  	if(argc>1)
  		url = argv[1];
  
  	try
  	{
  		sprintf(endpoint, "%s", url);
  		NestedComplex ws(endpoint);
  
  		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++";
  
  		intArray.m_Size = ARRAYSIZE;
  		intArray.m_Array = new xsd__int[ARRAYSIZE];
  		intArray.m_Array[0] = 6;
  		intArray.m_Array[1] = 7;
  
  		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;
  
  		response = ws.echoNestedComplex(&complexType2);
  		cout << response->complexType1Array.m_Array[0]->ct1_string << endl;
  		cout << response->complexType1Array.m_Array[0]->ct1_int << endl;
  		cout << response->complexType1Array.m_Array[0]->simpleArrays->stringArray.m_Array[0]
<< " ";
  		cout << response->complexType1Array.m_Array[0]->simpleArrays->stringArray.m_Array[1]
<< endl;
  		cout << response->complexType1Array.m_Array[0]->simpleArrays->intArray.m_Array[0]
<< " ";
  		cout << response->complexType1Array.m_Array[0]->simpleArrays->intArray.m_Array[1]
<< endl;
  		cout << response->complexType1Array.m_Array[1]->ct1_string << endl;
  		cout << response->complexType1Array.m_Array[1]->ct1_int << endl;
  		cout << response->complexType1Array.m_Array[1]->simpleArrays->stringArray.m_Array[0]
<< " ";
  		cout << response->complexType1Array.m_Array[1]->simpleArrays->stringArray.m_Array[1]
<< endl;
  		cout << response->complexType1Array.m_Array[1]->simpleArrays->intArray.m_Array[0]
<< " ";
  		cout << response->complexType1Array.m_Array[1]->simpleArrays->intArray.m_Array[1]
<< 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;
  }
  
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/cpp/PrimitiveAndArrayClient.cpp
  
  Index: PrimitiveAndArrayClient.cpp
  ===================================================================
  #include "PrimitiveAndArray.hpp"
  #include <axis/AxisException.hpp>
  #include <iostream>
  
  #define ARRAYSIZE 2
  
  int main(int argc, char* argv[])
  {
  	char endpoint[256];
  	const char* url="http://localhost:80/axis/Calculator";
  
  	if(argc>1)
  		url = argv[1];
  
  	try
  	{
  		sprintf(endpoint, "%s", url);
  		PrimitiveAndArray* ws = new PrimitiveAndArray(endpoint);
  
  		xsd__int single;
  		xsd__int_Array intArray;
  		ComplexReturn* response;
  
  		single=37;
  
  		intArray.m_Size = ARRAYSIZE;
  		intArray.m_Array = new xsd__int[ARRAYSIZE];
  		intArray.m_Array[0] = 6;
  		intArray.m_Array[1] = 7;
  
  		response = ws->sendPrimitiveAndArray(single, intArray);
  		cout << response->returnInt << " " << response->returnArray.m_Array[0]
<< " " << response->returnArray.m_Array[1] << endl;
  
  		single=43;
  		intArray.m_Array[0] = 13;
  		intArray.m_Array[1] = 17;
  		response = ws->sendArrayAndPrimitive(intArray, single);
  		cout << response->returnInt << " " << response->returnArray.m_Array[0]
<< " " << response->returnArray.m_Array[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;
  }
  
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/output/NestedArrays.expected
  
  Index: NestedArrays.expected
  ===================================================================
  8 0
  ---------------------- TEST COMPLETE -----------------------------
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/output/NestedComplex.expected
  
  Index: NestedComplex.expected
  ===================================================================
  Hello
  13
  Apache Axis C++
  6 7
  World
  27
  Apache Axis C++
  6 7
  ---------------------- TEST COMPLETE -----------------------------
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/output/PrimitiveAndArray.expected
  
  Index: PrimitiveAndArray.expected
  ===================================================================
  37 6 7
  43 13 17
  ---------------------- TEST COMPLETE -----------------------------
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/tests/NestedArrays.xml
  
  Index: NestedArrays.xml
  ===================================================================
  <test>
      <name>NestedArrays</name>
      <description>NestedArrays</description>
      <clientLang>cpp</clientLang>
      <clientCode>NestedArraysClient.cpp</clientCode>
      <wsdl>NestedArrays.wsdl</wsdl>
      <expected>
          <output>
              NestedArrays.expected
          </output>
      </expected>
  	<endpoint>http://localhost:80/NestedArrays/services/NestedArrays</endpoint>
  </test>
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/tests/NestedComplex.xml
  
  Index: NestedComplex.xml
  ===================================================================
  <test>
      <name>NestedComplex</name>
      <description>NestedComplex</description>
      <clientLang>cpp</clientLang>
      <clientCode>NestedComplexClient.cpp</clientCode>
      <wsdl>NestedComplex.wsdl</wsdl>
      <expected>
          <output>
              NestedComplex.expected
          </output>
      </expected>
  	<endpoint>http://localhost:80/NestedComplex/services/NestedComplex</endpoint>
  </test>
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/tests/PrimitiveAndArray.xml
  
  Index: PrimitiveAndArray.xml
  ===================================================================
  <test>
      <name>PrimitiveAndArray</name>
      <description>PrimitiveAndArray</description>
      <clientLang>cpp</clientLang>
      <clientCode>PrimitiveAndArrayClient.cpp</clientCode>
      <wsdl>PrimitiveAndArray.wsdl</wsdl>
      <expected>
          <output>
              PrimitiveAndArray.expected
          </output>
      </expected>
  	<endpoint>http://localhost:80/PrimitiveAndArray/services/PrimitiveAndArray</endpoint>
  </test>
  
  
  

Mime
View raw message