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 di...@apache.org on 2006/01/17 18:30:52 UTC

svn commit: r369844 - in /webservices/axis/trunk/c/tests/auto_build/testcases: client/cpp/RpcHttpHeaderTest7Client.cpp output/RpcHttpHeaderTest7.cpp.out

Author: dicka
Date: Tue Jan 17 09:30:48 2006
New Revision: 369844

URL: http://svn.apache.org/viewcvs?rev=369844&view=rev
Log:
Update testcase following recent change to get/setTransportProperties API.

Also taken opportunity to tidy up testcase.

Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/RpcHttpHeaderTest7Client.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/output/RpcHttpHeaderTest7.cpp.out

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/RpcHttpHeaderTest7Client.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/RpcHttpHeaderTest7Client.cpp?rev=369844&r1=369843&r2=369844&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/RpcHttpHeaderTest7Client.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/RpcHttpHeaderTest7Client.cpp Tue Jan 17 09:30:48 2006
@@ -25,6 +25,7 @@
  */
 
 #include <string>
+#include <iostream>
 using namespace std;
 
 #include "InteropTestPortType.hpp"
@@ -40,76 +41,87 @@
     char endpoint[256];
     const char *server = "localhost";
     const char *port = "80";
-    
+
     //endpoint for Axis CPP sample
     sprintf(endpoint, "http://%s:%s/axis/base", server, port);
-   
-	// Set the endpoint from command line argument if set
-	if (argc > 1)
-		strcpy(endpoint, argv[1]);
-
-	
-	
-	/*Set for HTTP transport */
+
+    // Set the endpoint from command line argument if set
+    if (argc > 1)
+    {
+        strcpy(endpoint, argv[1]);
+    }
+
+    /*Set for HTTP transport */
     InteropTestPortType ws(endpoint, APTHTTP1_1);
 
     //set HTTP headers
-     ws.setTransportProperty("Accept-Language", NULL);
+    ws.setTransportProperty("Accept-Language", NULL);
 
-    printf("invoking echoString...\n");
+    cout << "invoking echoString..." << endl;
     //testing echoString 
-		bool bSuccess = false;
-		int	iRetryIterationCount = 3;
+    bool bSuccess = false;
+    int	iRetryIterationCount = 3;
 
-		do
-		{
-    try {
-    if (0 == strcmp(ws.echoString("hello world"), "hello world"))
-	printf("successful\n");
-    else
-	printf("failed\n");
-
-	bSuccess = true;
-	}
-    catch(AxisException& e) 
+    do
     {
-			bool bSilent = false;
-
-			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
-			{
-				if( iRetryIterationCount > 0)
-				{
-					bSilent = true;
-				}
-			}
-			else
-			{
-				iRetryIterationCount = 0;
-			}
+        try
+        {
+            if (0 == strcmp(ws.echoString("hello world"), "hello world"))
+            {
+                cout << "successful" << endl;
+            }
+            else
+            {
+                cout << "failed" << 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)
-			{
-        printf("%s\n", e.what());
-			}
-    }
-    catch(...)
-    {
-        printf("Unknown exception\n");
-    }
-		iRetryIterationCount--;
-		} while( iRetryIterationCount > 0 && !bSuccess);
-
-    printf("Test transport property accessors\n");
-    printf("First transport key = %s\n", ws.getFirstTransportPropertyKey());
-    printf("First transport value = %s\n",
-           ws.getCurrentTransportPropertyValue()); 
+            {
+                cout << "AxisException : " << e.what() << endl;
+            }
+        }
+        catch(exception& e)
+        {
+            cout << "Unexpected exception : " << e.what() << endl;
+        }
+        catch(...)
+        {
+            cout << "Unknown exception" << endl;
+        }
+
+        iRetryIterationCount--;
+    } while( iRetryIterationCount > 0 && !bSuccess);
+
+    cout << "Test transport property accessors" << endl;
+    cout << "First transport key = ";
+    cout << ws.getFirstTransportPropertyKey(false) << endl;
+    cout << "First transport value = ";
+    cout << ws.getCurrentTransportPropertyValue(false) << endl; 
     const char *key = NULL;
     int count = 1;
-    while (key = ws.getNextTransportPropertyKey())
+    while (key = ws.getNextTransportPropertyKey(false))
     {
-        printf("Next transport key = %s\n", key);
-        printf("Next transport value = %s\n",
-               ws.getCurrentTransportPropertyValue());
+        cout << "Next transport key = " << key << endl;
+        cout << "Next transport value = ";
+        cout << ws.getCurrentTransportPropertyValue(false) << endl;
         count++;
     }
 
@@ -117,49 +129,56 @@
     ws.deleteTransportProperty("Accept-Language");
 
     //now the request should not have these removed headers
-		bSuccess = false;
-		iRetryIterationCount = 3;
+    bSuccess = false;
+    iRetryIterationCount = 3;
 
-		do
-		{
-    try
+    do
     {
-    if (0 == strcmp(ws.echoString("hello world"), "hello world"))
-        printf("successful\n");
-    else
-        printf("failed\n");
-
-				bSuccess = true;
-    }
-    catch(AxisException& e)
-    {
-			bool bSilent = false;
-
-			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
-			{
-				if( iRetryIterationCount > 0)
-				{
-					bSilent = true;
-				}
-			}
-			else
-			{
-				iRetryIterationCount = 0;
-			}
+        try
+        {
+            if (0 == strcmp(ws.echoString("hello world"), "hello world"))
+            {
+                cout << "successful" << endl;
+            }
+            else
+            {
+                cout << "failed" << 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)
-			{
-        printf("%s\n", e.what());
-			}
-    }
-    catch(...)
-    {
-        printf("Unknown exception\n");
-    }
-		iRetryIterationCount--;
-		} while( iRetryIterationCount > 0 && !bSuccess);
-
+            {
+                cout << "AxisException : " << e.what() << endl;
+            }
+        }
+        catch(exception& e)
+        {
+            cout << "Unexpected exception : " << e.what() << endl;
+        }
+        catch(...)
+        {
+            cout << "Unknown exception" << endl;
+        }
+    iRetryIterationCount--;
+    } while( iRetryIterationCount > 0 && !bSuccess);
 
-    printf("HTTP Header test end\n");
+    cout << "HTTP Header test end" << endl;
     return 0;
 }

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/output/RpcHttpHeaderTest7.cpp.out
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/output/RpcHttpHeaderTest7.cpp.out?rev=369844&r1=369843&r2=369844&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/RpcHttpHeaderTest7.cpp.out (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/RpcHttpHeaderTest7.cpp.out Tue Jan 17 09:30:48 2006
@@ -1,7 +1,9 @@
 invoking echoString...
 successful
 Test transport property accessors
-First transport key = (null)
-First transport value = (null)
+First transport key = SOAPAction
+First transport value = "InteropBase#echoString"
+Next transport key = Content-Length
+Next transport value = 405
 successful
 HTTP Header test end