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 pr...@apache.org on 2005/11/11 18:46:53 UTC

svn commit: r332619 - in /webservices/axis/trunk/c: src/transport/axis3/ tests/auto_build/testcases/client/cpp/ tests/auto_build/testcases/output/ tests/auto_build/testcases/tests/

Author: prestonf
Date: Fri Nov 11 09:46:43 2005
New Revision: 332619

URL: http://svn.apache.org/viewcvs?rev=332619&view=rev
Log:
Part of the fix for AXISCPP-868

Added:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany.cpp.out
    webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany_ServerResponse.expected
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/CalculatorDocMany.xml
Modified:
    webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp

Modified: webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp?rev=332619&r1=332618&r2=332619&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp (original)
+++ webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp Fri Nov 11 09:46:43 2005
@@ -1094,13 +1094,13 @@
 	    	// if HTTP/1.1 we have to assume persistant connection by default
 
 	    	// We need to close the connection and open a new one if we have 'Connection: close'
-			if( key == "Connection" && value == " close")
+			if( key == "Connection" && (value == " close" || value == " Close"))
 			{
 				m_bReopenConnection = true;
 			}
 
             // We need to close the connection and open a new one if we have 'Proxy-Connection: close'
-            if (key == "Proxy-Connection" && value == " close")
+            if (key == "Proxy-Connection" && (value == " close" || value == " Close"))
                 m_bReopenConnection = true;
 
 	    	// For both HTTP/1.0 and HTTP/1.1,

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp?rev=332619&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CalculatorDocManyClient.cpp Fri Nov 11 09:46:43 2005
@@ -0,0 +1,189 @@
+// 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 "Calculator.hpp"
+#include <axis/AxisException.hpp>
+#include <ctype.h>
+#include <iostream>
+#include <signal.h>
+
+void sig_handler(int);
+void PrintUsage();
+bool IsNumber( const char * p);
+
+typedef enum
+{
+	eAdd,
+	eSub,
+	eMul,
+	eDiv
+} EOPERATION;
+
+int main( int argc, char * argv[])
+{
+	char *		pURL = "http://localhost:80/axis/Calculator";
+	char *		pOpList[] = {"add", "sub", "mul", "div", "*"};
+	int			iValue1List[] = {2,  5,  23, 5879, 123,  76, 94, 3987, 432, 65, 0};
+	int			iValue2List[] = {3, 99, 243,    8, 987, 987, 45,  908, -45,  0};
+	int			iResult;
+	int			iIndex_Value1List = 0;
+	int			iIndex_Value2List = 0;
+	EOPERATION	eOperation = eAdd;
+	bool		bSuccess = false;
+	int			iRetryIterationCount = 3;
+	char		cSign;
+	int			iIterationCount = 20000;
+	int			iIteration;
+
+	signal( SIGILL, sig_handler);
+	signal( SIGABRT, sig_handler);
+	signal( SIGSEGV, sig_handler);
+	signal( SIGFPE, sig_handler);
+
+	if( argc > 0)
+	{
+		pURL = argv[1];
+	}
+
+	do
+	{
+		try
+		{
+			Calculator	ws( pURL);
+
+			cout << "Invoke the same web service method " << iIterationCount << " times without closing the connection." << endl;
+
+			for( iIteration = 0; iIteration < iIterationCount; iIteration++)
+			{
+				switch( eOperation)
+				{
+					case eAdd:
+					{
+						iResult = ws.add( iValue1List[iIndex_Value1List],
+										  iValue2List[iIndex_Value2List]);
+						cSign = '+';
+						eOperation = eSub;
+						break;
+					}
+
+					case eSub:
+					{
+						iResult = ws.sub( iValue1List[iIndex_Value1List],
+										  iValue2List[iIndex_Value2List]);
+						cSign = '-';
+						eOperation = eMul;
+						break;
+					}
+
+					case eMul:
+					{
+						iResult = ws.mul( iValue1List[iIndex_Value1List],
+										  iValue2List[iIndex_Value2List]);
+						cSign = '*';
+						eOperation = eDiv;
+						break;
+					}
+
+					case eDiv:
+					{
+						iResult = ws.div( iValue1List[iIndex_Value1List],
+										  iValue2List[iIndex_Value2List]);
+						cSign = '/';
+						eOperation = eAdd;
+						break;
+					}
+				}
+
+				if( iIteration == iIterationCount / 4)
+				{
+					cout << "Quarter of the way there!" << endl;
+				}
+				else if( iIteration == iIterationCount / 2)
+				{
+					cout << "Half of the way there!" << endl;
+				}
+				else if( iIteration == (3 * iIterationCount) / 4)
+				{
+					cout << "Three quarters of the way there!" << endl;
+				}
+				else if( iIteration == iIterationCount - 1)
+				{
+					cout << "All the way there!" << endl;
+
+					bSuccess = true;
+				}
+
+				if( iValue1List[++iIndex_Value1List] == 0)
+				{
+					iIndex_Value1List = 0;
+				}
+
+				if( iValue2List[++iIndex_Value2List] == 0)
+				{
+					iIndex_Value2List = 0;
+				}
+			}
+		}
+		catch( AxisException& e)
+		{
+			bool bSilent = false;
+
+			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+			{
+				if( iRetryIterationCount > 1)
+				{
+					bSilent = true;
+				}
+			}
+			else
+			{
+				iRetryIterationCount = 0;
+			}
+
+            if( !bSilent)
+			{
+				cout << "Exception : " << e.what() << endl;
+			}
+		}
+		catch( exception& e)
+		{
+			cout << "Exception has occured:" << e.what() << endl;
+		}
+		catch(...)
+		{
+			cout << "Unknown exception has occured" << endl;
+		}
+
+		if( !bSuccess)
+		{
+			iRetryIterationCount--;
+
+			cout << "Iteration: " << iIteration << " " << iValue1List[iIndex_Value1List] << cSign << iValue2List[iIndex_Value2List] << "=" << iResult << endl;
+		}
+
+	} while( iRetryIterationCount > 0 && !bSuccess);
+
+	cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+	
+	return 0;
+}
+
+void sig_handler( int sig)
+{
+	signal( sig, sig_handler);
+    cout << "SIGNAL RECEIVED " << sig << endl;
+	exit( 1);
+}
+

Added: webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany.cpp.out
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany.cpp.out?rev=332619&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany.cpp.out (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany.cpp.out Fri Nov 11 09:46:43 2005
@@ -0,0 +1,6 @@
+Invoke the same web service method 20000 times without closing the connection.
+Quarter of the way there!
+Half of the way there!
+Three quarters of the way there!
+All of the way there!
+---------------------- TEST COMPLETE -----------------------------

Added: webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany_ServerResponse.expected
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany_ServerResponse.expected?rev=332619&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany_ServerResponse.expected (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/CalculatorDocMany_ServerResponse.expected Fri Nov 11 09:46:43 2005
@@ -0,0 +1,11 @@
+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
+
+1ad
+<?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><addResponse xmlns="http://localhost/axis/Calculator"><addReturn>5</addReturn></addResponse></soapenv:Body></soapenv:Envelope>
+0
+

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/CalculatorDocMany.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/CalculatorDocMany.xml?rev=332619&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/CalculatorDocMany.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/CalculatorDocMany.xml Fri Nov 11 09:46:43 2005
@@ -0,0 +1,13 @@
+<test>
+    <name>CalculatorDocMany</name>
+    <description>CalculatorDocMany</description>
+    <clientLang>cpp</clientLang>
+    <clientCode>CalculatorDocManyClient.cpp</clientCode>
+    <wsdl>CalculatorDoc.wsdl</wsdl>
+    <expected>
+        <output>
+            CalculatorDocMany.cpp.out
+        </output>
+    </expected>
+	<endpoint>http://localhost:80/axis/CalculatorDoc</endpoint>
+</test>