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 ha...@apache.org on 2005/12/22 10:43:24 UTC

svn commit: r358542 - in /webservices/axis/trunk/c/tests/auto_build/testcases: client/cpp/ output/ tests/ wsdls/

Author: hawkeye
Date: Thu Dec 22 01:43:16 2005
New Revision: 358542

URL: http://svn.apache.org/viewcvs?rev=358542&view=rev
Log:
Added a new test for AXISCPP-753

Added:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/HiddenMessageParts.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC.cpp.out
    webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC_ServerResponse.expected
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/HiddenMessageParts.xml
    webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/HiddenMessageParts_RPC.wsdl
Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp?rev=358542&r1=358541&r2=358542&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp Thu Dec 22 01:43:16 2005
@@ -1,6 +1,10 @@
 #ifndef __COMMONHEADERFILE
 #define __COMMONHEADERFILE
 
+// Prototype
+bool parse_args(int *argc, char *argv[], char **endpoint);
+void shift_args_up(int i, int *argc, char *argv[]);
+
 #ifdef WIN32
 	#if defined(_MSC_VER) && (_MSC_VER < 1300)
 	// Bug in MS Visual C++ 6.0. Fixed in Visual C++ .Net version.
@@ -158,5 +162,72 @@
 }
 
 #endif
+/* Spin through args list and check for -e -p and -s options.
+   Option values are expected to follow the option letter as the next
+   argument.
+ 
+   These options and values are removed from the arg list.
+   If both -e and -s and or -p, then -e takes priority
+*/
+bool parse_args(int *argc, char *argv[], char **endpoint) {
+
+    // We need at least 2 extra arg after program name
+    if(*argc < 3)
+        return false;
+
+    char *server = "localhost";
+    int  port = 80;
+    bool ep_set = false;
+    bool server_set = false;
+    bool port_set = false;
+
+    for(int i=1; i<*argc; i++) {
+        if(*argv[i] == '-') {
+            switch(*(argv[i]+1)) {
+            case 'e':
+                *endpoint = strdup(argv[i+1]);
+                ep_set = true;
+                shift_args_up(i, argc, argv);
+                i--;
+                break;
+            case 's':
+                server = strdup(argv[i+1]);
+                server_set = true;
+                shift_args_up(i, argc, argv);
+                i--;
+                break;
+            case 'p':
+                port = atoi(argv[i+1]);
+                if(port >80) port_set = true;
+                shift_args_up(i, argc, argv);
+                i--;
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    // use the supplied server and/or port to build the endpoint
+    if(ep_set == false && (server_set || port_set)) {
+        // Set p to the location of the first '/' after the http:// (7 chars)
+        // e.g. from http://localhost:80/axis/base gets /axis/base
+        char *ep_context = strpbrk(&(*endpoint)[7], "/");
+
+        // http://:/ is 9 characters + terminating NULL character so add 10.
+        // Allow space for port number upto 999999 6 chars
+        *endpoint = (char *)calloc(1, 10 + strlen(ep_context) + strlen(server) + 6);
+        sprintf(*endpoint, "http://%s:%d/%s", server, port, ep_context+1);
+        if(server_set) free(server);
+        ep_set = true;
+    }
+
+    return ep_set;
+}
+void shift_args_up(int i, int *argc, char *argv[]) {
+    for(int j=i, k=i+2; j<*(argc)-2; j++, k++)
+        argv[j]=argv[k];
+    *argc-=2;
+}
 
 #endif

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/HiddenMessageParts.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/HiddenMessageParts.cpp?rev=358542&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/HiddenMessageParts.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/HiddenMessageParts.cpp Thu Dec 22 01:43:16 2005
@@ -0,0 +1,68 @@
+#include "PruebaDatosCabecera.hpp"
+#include "PruebasBugPortType.hpp"
+#include "CommonClientTestCode.hpp"
+#include <iostream>
+#include <axis/AxisException.hpp>
+#include <ctype.h>
+
+#define WSDL_DEFAULT_ENDPOINT "http://localhost:80/axis/BasicAll"
+
+void PrintUsage();
+
+int
+main (int argc, char *argv[])
+{
+    char *endpoint = WSDL_DEFAULT_ENDPOINT;
+    bool endpoint_set = parse_args(&argc, argv, &endpoint); 
+    
+    int returnValue = 1;	// Assume Failure
+
+	bool bSuccess = false;
+    PruebasBugPortType* ws;
+		try
+		{
+            if(endpoint_set) 
+            {
+              ws = new PruebasBugPortType(endpoint, APTHTTP1_1);
+              free(endpoint);
+              endpoint_set = false;
+            } 
+            else
+            {
+              ws = new PruebasBugPortType();
+            }
+          
+            PruebaDatosCabecera* data = new PruebaDatosCabecera();
+            data->setIdenOrgNac("23");
+            data->setNumSec("12");
+            
+            printf("Sending.................\n");
+            xsd__int returnVal = ws->AbySend(data);
+            cout << "result = "<<returnVal<<endl;
+			
+			bSuccess = true;
+			delete data;
+		}
+		catch (AxisException & e)
+		{
+			bool bSilent = false;
+
+			printf ("%s\n", e.what ());
+		}
+		catch (exception & e)
+		{
+			printf ("%s\n", e.what ());
+		}	
+		catch (...)
+		{
+			cerr << "Unknown Exception occured." << endl;
+		}
+
+
+    cout <<
+	"---------------------- TEST COMPLETE -----------------------------"
+	<< endl;
+
+    return returnValue;
+
+}

Added: webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC.cpp.out
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC.cpp.out?rev=358542&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC.cpp.out (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC.cpp.out Thu Dec 22 01:43:16 2005
@@ -0,0 +1,3 @@
+Sending.................
+result = 93
+---------------------- TEST COMPLETE -----------------------------

Added: webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC_ServerResponse.expected
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC_ServerResponse.expected?rev=358542&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC_ServerResponse.expected (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/HiddenMessageParts_RPC_ServerResponse.expected Thu Dec 22 01:43:16 2005
@@ -0,0 +1,16 @@
+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>
+<PruebasBugResponse xmlns="http://www.abysal.com/soap/PruebasBug.wsdl">
+<PruebasBugReturn xsi:type="xsd:int">93</PruebasBugReturn>
+</PruebasBugResponse>
+</soapenv:Body>
+</soapenv:Envelope>
+0

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/HiddenMessageParts.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/HiddenMessageParts.xml?rev=358542&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/HiddenMessageParts.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/HiddenMessageParts.xml Thu Dec 22 01:43:16 2005
@@ -0,0 +1,14 @@
+<test>
+    <name>HiddenMessageParts_RPC</name>
+    <description>Fixes AXISCPP-753 where message parts were using anonymous types.</description>
+    <clientLang>cpp</clientLang>
+    <clientCode>HiddenMessageParts.cpp</clientCode>
+    <wsdl>HiddenMessageParts_RPC.wsdl</wsdl>
+    <expected>
+        <output>
+            HiddenMessageParts_RPC.cpp.out
+        </output>
+		<serverResponse>HiddenMessageParts_RPC_ServerResponse.expected</serverResponse>
+    </expected>
+	<endpoint>-e http://localhost:80/axis/UNIT_TEST_ONLY</endpoint>
+</test>

Added: webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/HiddenMessageParts_RPC.wsdl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/HiddenMessageParts_RPC.wsdl?rev=358542&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/HiddenMessageParts_RPC.wsdl (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/HiddenMessageParts_RPC.wsdl Thu Dec 22 01:43:16 2005
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions
+    name="PruebasBug"
+    targetNamespace="http://www.abysal.com/soap/PruebasBug.wsdl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:tns="http://www.abysal.com/soap/PruebasBug.wsdl"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+   <types>
+      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+         <xs:element name="PruebaDatosCabecera">
+            <xs:complexType>
+               <xs:sequence>
+                  <xs:element name="IdenOrgNac" type="xsd:string"/>
+                  <xs:element name="NumSec" type="xsd:string"/>
+               </xs:sequence>
+            </xs:complexType>
+         </xs:element>
+      </xs:schema>
+   </types>
+   <message name="PruebasBugInput">
+      <part name="PruebasBugId" element="tns:PruebaDatosCabecera"></part>
+   </message>
+   <message name="PruebasBugResponse">
+      <part name="PruebasBugReturn" type="xsd:int"></part>
+   </message>
+   <portType name="PruebasBugPortType">
+      <operation name="AbySend" parameterOrder="PruebasBugId">
+         <input message="tns:PruebasBugInput"/>
+         <output message="tns:PruebasBugResponse"/>
+      </operation>
+   </portType>
+   <binding name="PruebasBugBinding" type="tns:PruebasBugPortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <operation name="AbySend">
+            <soap:operation soapAction=""/>
+            <input>
+                <soap:body
+                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+                    namespace="http://www.abysal.com/Abysal-webDTP"
+                    use="encoded"/>
+            </input>
+            <output>
+                <soap:body
+                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+                    namespace="http://www.abysal.com/Abysal-webDTP"
+                    use="encoded"/>
+            </output>
+        </operation>
+    </binding>
+    <service name="PruebasBugService">
+        <port binding="tns:PruebasBugBinding" name="PruebasBugPort">
+            <soap:address location="http://aries:8080/axis/services/PruebasBug"/>
+        </port>
+    </service>
+</definitions> 
\ No newline at end of file