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/06/10 17:33:39 UTC
cvs commit: ws-axis/c/tests/auto_build/testcases/wsdls MultiOut.wsdl
whitlock 2005/06/10 08:33:39
Modified: c/tests/auto_build UnitTest_Readme.txt
c/tests/auto_build/testcases/client/cpp
SimpleArraysClient.cpp
c/tests/utils/monitor/org/apache/test MockServerThread.java
Added: c/tests/auto_build/testcases/client/cpp MultiOutClient.cpp
c/tests/auto_build/testcases/output MultiOut.expected
MultiOutServerResponse.expected
c/tests/auto_build/testcases/tests MultiOut.xml
c/tests/auto_build/testcases/wsdls MultiOut.wsdl
Log:
Update the mock server to automatically calculate the soap message length and add in MultiOut unit testcase that tests out mulitple output parameters
Revision Changes Path
1.2 +3 -0 ws-axis/c/tests/auto_build/UnitTest_Readme.txt
Index: UnitTest_Readme.txt
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/UnitTest_Readme.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UnitTest_Readme.txt 8 Jun 2005 15:52:08 -0000 1.1
+++ UnitTest_Readme.txt 10 Jun 2005 15:33:39 -0000 1.2
@@ -55,6 +55,9 @@
3. Place the expected server response into the output directory
e.g. tests/auto_build/testcases/output/CalculatorDoc_serverResponse.expected
+ The server response file has a length after the HTTP headers but before the SOAP envelope. This is the
+ length in hex of the remainder of the message. Since this is awkward to calculate manually, it may
+ be left as ### and the mock server will automatically calculate the length.
Please see the file tests/auto_build/testcases/output/ComplexLists_ServerResponse.expected for an example of
a test that calls a server multiple times.
\ No newline at end of file
1.7 +7 -4 ws-axis/c/tests/auto_build/testcases/client/cpp/SimpleArraysClient.cpp
Index: SimpleArraysClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/SimpleArraysClient.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SimpleArraysClient.cpp 23 Mar 2005 15:45:06 -0000 1.6
+++ SimpleArraysClient.cpp 10 Jun 2005 15:33:39 -0000 1.7
@@ -136,18 +136,21 @@
long_in.m_Array = new xsd__long*[ARRAYSIZE];
xsd__long * longArray = new xsd__long[ARRAYSIZE];
long_in.m_Size = ARRAYSIZE;
- for (x=0; x<ARRAYSIZE; x++)
+ for (xsd__long xx=0; xx<ARRAYSIZE; xx++)
{
- longArray[x] = (xsd__long) x+ 200001;
- long_in.m_Array[x] = &longArray[x];
+ longArray[xx] = xx + 10000000001I64;
+ long_in.m_Array[xx] = &longArray[xx];
}
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)
+ {
+ printf("long[0]=<%I64d>\n", *(long_out.m_Array[0]));
+ if(*(long_out.m_Array[0]) == 10000000001I64)
cout << "successful "<<endl;
else
cout << "failed "<<endl;
+ }
else
cout << "failed "<<endl;
1.1 ws-axis/c/tests/auto_build/testcases/client/cpp/MultiOutClient.cpp
Index: MultiOutClient.cpp
===================================================================
// Copyright 2003-2004 The Apache Software Foundation.
// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "MultiOut.hpp"
#include <axis/AxisException.hpp>
#include <ctype.h>
#include <iostream>
int main(int argc, char* argv[])
{
bool bSuccess = false;
int iRetryIterationCount = 3;
do
{
try
{
MultiOut ws(argv[1]);
xsd__int Value0 = 12;
xsd__string OutValue0 = NULL;
xsd__integer OutValue1 = 0;
xsd__int OutValue2 = 0;
xsd__long OutValue3 = 0;
xsd__short OutValue4 = 0;
xsd__decimal OutValue5 = 0;
xsd__float OutValue6 = 0;
xsd__double OutValue7 = 0;
xsd__boolean OutValue8 = false_;
xsd__byte OutValue9 = 0;
ws.get(Value0,
&OutValue0,
&OutValue1,
&OutValue2,
&OutValue3,
&OutValue4,
&OutValue5,
&OutValue6,
&OutValue7,
&OutValue8,
&OutValue9);
char sInteger[128], sLong[128];
sprintf(sInteger,"%I64d",OutValue1);
sprintf(sLong,"%I64d",OutValue3);
cout << OutValue0 << endl;
cout << sInteger << endl;
cout << OutValue2 << endl;
cout << sLong << endl;
cout << OutValue4 << endl;
cout << OutValue5 << endl;
cout << OutValue6 << endl;
cout << OutValue7 << endl;
cout << OutValue8 << endl;
cout << OutValue9 << endl;
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(exception& e)
{
cout << "Unknown exception has occured" << endl;
}
catch(...)
{
cout << "Unknown exception has occured" << endl;
}
iRetryIterationCount--;
} while( iRetryIterationCount > 0 && !bSuccess);
cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
return 0;
}
1.2 +8 -0 ws-axis/c/tests/utils/monitor/org/apache/test/MockServerThread.java
Index: MockServerThread.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/utils/monitor/org/apache/test/MockServerThread.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MockServerThread.java 8 Jun 2005 15:52:06 -0000 1.1
+++ MockServerThread.java 10 Jun 2005 15:33:39 -0000 1.2
@@ -259,6 +259,14 @@
for(int i=1; i<responseStrings.length; i++)
{
String tmpString="HTTP"+responseStrings[i];
+ int hash = tmpString.indexOf("###");
+ if (-1 != hash)
+ {
+ String len = Integer.toHexString(tmpString.length() - hash - 3);
+ if (3 != len.length())
+ throw new RuntimeException("Message length in hex was not 3 characters long "+len);
+ tmpString = tmpString.substring(0,hash) + len + tmpString.substring(hash+3);
+ }
responses[i-1]=tmpString.toCharArray( );
}
}
1.1 ws-axis/c/tests/auto_build/testcases/output/MultiOut.expected
Index: MultiOut.expected
===================================================================
5
---------------------- TEST COMPLETE -----------------------------
1.1 ws-axis/c/tests/auto_build/testcases/output/MultiOutServerResponse.expected
Index: MultiOutServerResponse.expected
===================================================================
HTTP/1.1 200 OK
Server: WebSphere Application Server/5.1
Content-Type: text/xml; charset=utf-8
Content-Language: en-GB
Transfer-Encoding: chunked
###
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><get xmlns="http://localhost/axis/MultiOut"><out1>Hello Mark</out1><out14>23</out14><out15>23</out15><out16>23</out16><out17>23</out17><out18>23</out18><out19>23.1</out19><out20>23.1</out20><out21>1</out21><out22>23</out22></get></soapenv:Body></soapenv:Envelope>
0
1.1 ws-axis/c/tests/auto_build/testcases/tests/MultiOut.xml
Index: MultiOut.xml
===================================================================
<test>
<name>MultiOut</name>
<description>MultiOut</description>
<clientLang>cpp</clientLang>
<clientCode>MultiOutClient.cpp</clientCode>
<wsdl>MultiOut.wsdl</wsdl>
<expected>
<output>
MultiOut.cpp.out
</output>
<serverResponse>
MultiOutServerResponse.expected
</serverResponse>
</expected>
<endpoint>http://localhost:80/axis/MultiOut</endpoint>
</test>
1.1 ws-axis/c/tests/auto_build/testcases/wsdls/MultiOut.wsdl
Index: MultiOut.wsdl
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2003-2004 The Apache Software Foundation. -->
<!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved -->
<!-- -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
<!-- you may not use this file except in compliance with the License. -->
<!-- You may obtain a copy of the License at -->
<!-- -->
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
<!-- -->
<!-- Unless required by applicable law or agreed to in writing, software -->
<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
<!-- See the License for the specific language governing permissions and -->
<!-- limitations under the License. -->
<wsdl:definitions targetNamespace="http://localhost/axis/MultiOut"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost/axis/MultiOut"
xmlns:intf="http://localhost/axis/MultiOut"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="http://localhost/axis/MultiOut"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost/axis/MultiOut"
xmlns:intf="http://localhost/axis/MultiOut"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<element name="get0">
<complexType>
<sequence>
<element name="in" type="xsd:int"/>
</sequence>
</complexType>
</element>
<element name="get">
<complexType>
<sequence>
<element name="out1" type="xsd:string"/>
<element nillable="true" name="out14" type="xsd:integer"/>
<element name="out15" type="xsd:int"/>
<element name="out16" type="xsd:long"/>
<element name="out17" type="xsd:short"/>
<element name="out18" type="xsd:decimal"/>
<element name="out19" type="xsd:float"/>
<element name="out20" type="xsd:double"/>
<element name="out21" type="xsd:boolean"/>
<element name="out22" type="xsd:byte"/>
<!--
<element name="out1" type="xsd:string"/>
<element name="out2" type="xsd:normalizedString"/>
<element name="out3" type="xsd:token"/>
<element name="out4" type="xsd:language"/>
<element name="out5" type="xsd:Name"/>
<element name="out6" type="xsd:NCName"/>
<element name="out7" type="xsd:ID"/>
<element name="out8" type="xsd:IDREF"/>
<element name="out9" type="xsd:IDREFS"/>
<element name="out10" type="xsd:ENTITY"/>
<element name="out11" type="xsd:ENTITIES"/>
<element name="out12" type="xsd:NMTOKEN"/>
<element name="out13" type="xsd:NMTOKENS"/>
<element name="out14" type="xsd:integer"/>
<element name="out15" type="xsd:int"/>
<element name="out16" type="xsd:long"/>
<element name="out17" type="xsd:short"/>
<element name="out18" type="xsd:decimal"/>
<element name="out19" type="xsd:float"/>
<element name="out20" type="xsd:double"/>
<element name="out21" type="xsd:boolean"/>
<element name="out22" type="xsd:byte"/>
<element name="out23" type="xsd:QName"/>
<element name="out24" type="xsd:NOTATION"/>
<element name="out25" type="xsd:dateTime"/>
<element name="out26" type="xsd:date"/>
<element name="out27" type="xsd:time"/>
<element name="out28" type="xsd:gYearMonth"/>
<element name="out29" type="xsd:gYear"/>
<element name="out30" type="xsd:gMonthDay"/>
<element name="out31" type="xsd:gDay"/>
<element name="out32" type="xsd:gMonth"/>
<element name="out33" type="xsd:duration"/>
<element name="out34" type="xsd:nonNegativeInteger"/>
<element name="out35" type="xsd:unsignedByte"/>
<element name="out36" type="xsd:unsignedInt"/>
<element name="out37" type="xsd:unsignedLong"/>
<element name="out38" type="xsd:unsignedShort"/>
<element name="out39" type="xsd:nonPositiveInteger"/>
<element name="out40" type="xsd:positiveInteger"/>
<element name="out41" type="xsd:negativeInteger"/>
<element name="out42" type="xsd:base64Binary"/>
<element name="out43" type="xsd:hexBinary"/>
<element name="out44" type="xsd:anyURI"/>
-->
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="get0">
<wsdl:part element="impl:get0" name="parameters"/>
</wsdl:message>
<wsdl:message name="get">
<wsdl:part element="impl:get" name="parameters"/>
</wsdl:message>
<wsdl:portType name="MultiOut">
<wsdl:operation name="get">
<wsdl:input message="impl:get0" name="get0"/>
<wsdl:output message="impl:get" name="get"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MultiOutSoapBinding" type="impl:MultiOut">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="get">
<wsdlsoap:operation soapAction="MultiOut#get"/>
<wsdl:input name="get0">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="get">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MultiOut">
<wsdl:port binding="impl:MultiOutSoapBinding" name="MultiOut">
<wsdlsoap:address location="http://localhost/axis/MultiOut"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>