Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 78060 invoked from network); 25 Jan 2005 16:33:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Jan 2005 16:33:53 -0000 Received: (qmail 84062 invoked by uid 500); 25 Jan 2005 16:33:50 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 84027 invoked by uid 500); 25 Jan 2005 16:33:49 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 83998 invoked by uid 99); 25 Jan 2005 16:33:49 -0000 X-ASF-Spam-Status: No, hits=-9.3 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME,WEIRD_PORT X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 25 Jan 2005 08:33:48 -0800 Received: (qmail 78003 invoked by uid 1927); 25 Jan 2005 16:33:47 -0000 Date: 25 Jan 2005 16:33:47 -0000 Message-ID: <20050125163347.78000.qmail@minotaur.apache.org> From: perryan@apache.org To: ws-axis-cvs@apache.org Subject: cvs commit: ws-axis/c/tests/auto_build/testcases/tests DynamicTest01.xml X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N perryan 2005/01/25 08:33:47 Modified: c/build buildTest.xml c/docs anttest-guide.html Added: c/tests/auto_build/testcases/dynamic/Test01 Calculator.cpp Calculator.hpp c/tests/auto_build/testcases/output DynamicTest01.expected c/tests/auto_build/testcases/tests DynamicTest01.xml Log: Updated the Ant test framework to allow dynamic clients to be compiled and tested. A very simple example dynamic client has been added too along with the standard framework files. The Ant test framework guide has been updated to reflect these changes. Revision Changes Path 1.5 +18 -13 ws-axis/c/build/buildTest.xml Index: buildTest.xml =================================================================== RCS file: /home/cvs/ws-axis/c/build/buildTest.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- buildTest.xml 10 Jan 2005 21:00:31 -0000 1.4 +++ buildTest.xml 25 Jan 2005 16:33:45 -0000 1.5 @@ -1,6 +1,10 @@ + + + + @@ -16,7 +20,7 @@ - + @@ -28,10 +32,6 @@ - @@ -41,17 +41,25 @@ - - + + + + + + + + + + + + - + @@ -67,9 +75,6 @@ - 1.2 +68 -9 ws-axis/c/docs/anttest-guide.html Index: anttest-guide.html =================================================================== RCS file: /home/cvs/ws-axis/c/docs/anttest-guide.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- anttest-guide.html 11 Dec 2004 15:26:14 -0000 1.1 +++ anttest-guide.html 25 Jan 2005 16:33:45 -0000 1.2 @@ -61,6 +61,7 @@ Test Properties Files
Conversions
Handlers
+Dynamic Clients
TCP Monitor Utility
Files Specific to Ant Test Framework
Files Required by Ant Test Framework
@@ -93,13 +94,13 @@ In order for the tests to run, the location of the XML parser libraries, XMLPARSER_HOME needs to be specified, and the install location of the Axis C++ package needs to be specified. These can either be specified on the command line or added to the platform specific properties files.

To run all tests type:

-
ant -f test.xml -Ddir.xmlParser=XMLPARSER_HOME -Ddir.package=PACKAGE
+
ant -f test.xml -Ddir.xmlParser=XMLPARSER_HOME -Ddir.release=PACKAGE

To run a sub-set of tests a file with the name of the test property files to be used for the test run. The location of the file needs to be passed to the Ant script. If a relative path is specified then it must be relevant to the BASEDIR directory. e.g. to run the subset of tests specified in a file called tests_to_run in the BASEDIR directory run:

-
ant -f test.xml -Ddir.xmlParser=XMLPARSER_HOME -Ddir.package=PACKAGE -Dtest.list=tests_to_run
+
ant -f test.xml -Ddir.xmlParser=XMLPARSER_HOME -Ddir.release=PACKAGE -Dtest.list=tests_to_run

To run an individual test specify the name of the test property file. e.g. to run only the CalculatorDoc test run:

-
ant -f test.xml -Ddir.xmlParser=XMLPARSER_HOME -Ddir.package=PACKAGE -Dtest.name=CalculatorDoc
+
ant -f test.xml -Ddir.xmlParser=XMLPARSER_HOME -Ddir.release=PACKAGE -Dtest.name=CalculatorDoc

Creating new tests

When creating a new test at least 3 files must be added to the test framework.

@@ -234,15 +235,17 @@
This is the endpoint for the service used in the test. The server or server:port portion of the endpoint is changed to point to the TCP monitor utility, which will forward the request to the testHost:testPort combination specified in the build.xx.properties file. The monitor will be started on localhost on the port specified by the monitorPort property in the properties file. e.g. if the web service is running on a server called testserver which is listening on port 9080, and the monitor is configured to listen on port 12345 then the endpoint in example 1 will be changed to http://localhost:12345/Calculator/services/Calculator and the monitor will forward the request to testserver:9080
+

- The example 2 show all the optional tags that are available. +

+ The example 2 shows all the optional tags that are available for handler tests.

   
        <test>
  -        <name>HandlerTest2</name>
  +        <name>HandlerTest02</name>
           <description>CalculatorDoc with Handler Chain</description>
           <clientLang>cpp</clientLang>
           <clientCode>CalculatorDocClient.cpp</clientCode>
  @@ -257,7 +260,7 @@
           </expected>
           <handler>
               <directory>
  -                handler_chain
  +                handler_test2
               </directory>
               <service>
                   Calculator
  @@ -292,6 +295,44 @@
               sent to the service.
       
   
  +	 

+ The example 3 shows all the optional tags that are available for dynamic client tests (See Dynamic Clients). +

+ +
+
  +
  +     <test>
  +        <name>DynamicTest01</name>
  +        <description>CalculatorDoc implemented as a dynamic client</description>
  +        <dynamicCode>true</dynamicCode>
  +        <dynamicCodeDirectory>Test01</dynamicCodeDirectory>
  +        <clientLang>cpp</clientLang>
  +        <wsdl>CalculatorDoc.wsdl</wsdl>
  +        <expected>
  +            <output>
  +                CalculatorDoc.cpp.out
  +            </output>
  +        </expected>
  +        <endpoint>http://localhost:80/Calculator/services/Calculator</endpoint>
  +    </test>
  +    
+
+

example 3

+ +

+ The optional tags shown in example 3 are detailed below. +

+ +
+
<dynamicCode>
+
This is a flag to indicate that the client is a dynamic client. The value has no relevance but must be set to something. WARNING setting it to false will have no effect. This property should only be used for dynamic client tests. Having this property will cause the framework to get the source from a different location and not to generate any stubs from the WSDL.
+ +
<dynamicCodeDirectory>
+
This is the name of the directory where all the dynamic code is copied from. All .cpp and .hpp files will be copied from this directory to the generated output directory.
+ +
+

Conversions

@@ -308,9 +349,8 @@
e.g.
-In example 2 above a directory of handler_chain was specified. This directory is the parent of the library directories, but a sub directory of the ws-axis/c/tests/auto_build/testcases/handlers/ directory. The handler_chain directory structure is shown in example 3 +In example 2 above a directory of handler_chain was specified. This directory is the parent of the library directories, but a sub directory of the ws-axis/c/tests/auto_build/testcases/handlers/ directory. The handler_chain directory structure is shown in example 4

-
   	
  @@ -325,7 +365,7 @@
   	
   	
-

example 3

+

example 4

When built this will produce 2 libraries in the test output directory called libtesthandler.so and libtesthandler2.so on Linux and testhandler.dll and testhandler2.dll on Windows. @@ -335,6 +375,25 @@ At present only <requestFlow ..> handlers are supported.

+ +

Dynamic Clients

+

+A dynamic client is a client that uses the Call object directly and all initialization must be done manually. A dynamic client does NOT use stubs generated from the WSDL. Of course the dynamic client may have been based originally on a generated Stub. Using the dynamic client approach gives the developer greater control over when the APIs are called and may provide access to data protected via the Stub interface. The big disadvtage of a dynamic client is that a new release of AxisC++ may break the client more easily than if generated Stubs were used. All the code for dynamic client needs to be placed into a sub-directory of the dynamic directory ws-axis/c/tests/auto_build/testcases/dynamic. +
+e.g. +
+In example 3 above a dynamicCodeDirectory of Test01 was specified. This directory is a sub directory of the ws-axis/c/tests/auto_build/testcases/dynamic directory. This directory structure is shown in example 5. +

+
+
  +	
  +        Test01/Calculator.cpp
  +        Test01/Calculator.hpp
  +	
  +	
+
+

example 5

+

TCP Monitor Utility

1.1 ws-axis/c/tests/auto_build/testcases/dynamic/Test01/Calculator.cpp Index: Calculator.cpp =================================================================== /* * This is a manually edited version of the Generated stub code for CaluclatorDoc.wsdl * to simplify the code to allow the cpp file to be edited to be used as a dynamic client * perryan@uk.ibm.com */ #include "Calculator.hpp" #include Calculator::Calculator (const char *pcEndpointUri, AXIS_PROTOCOL_TYPE eProtocol) { m_pCall = new Call (); m_pCall->setProtocol (eProtocol); m_pCall->setEndpointURI (pcEndpointUri); } Calculator::Calculator () { m_pCall = new Call (); m_pCall->setEndpointURI ("http://localhost/axis/Calculator"); } Calculator::~Calculator () { } /* * A new test method which is called from elsewhere in the code. New test * methods can be used to keep things clean. perryan@uk.ibm.com */ void Calculator::printProtocolType () { printf ("protocol type = %d\n", m_pCall->getProtocol ()); } /* * This method wrap the service methoddiv */ xsd__int Calculator::div (xsd__int Value0, xsd__int Value1) { xsd__int Ret = 0; const char * pcCmplxFaultName; #define DEFAULT_WSDL_ENDPOINT "http://localhost/axis/Calculator" try { if (AXIS_SUCCESS != m_pCall->initialize (CPP_DOC_PROVIDER)) return Ret; m_pCall->setTransportProperty (SOAPACTION_HEADER, "Calculator#div"); m_pCall->setSOAPVersion (SOAP_VER_1_1); m_pCall->setOperation ("div", DEFAULT_WSDL_ENDPOINT); printProtocolType (); includeSecure (); char cPrefixAndParamName0[17]; sprintf (cPrefixAndParamName0, "%s:arg_0_3", m_pCall->getNamespacePrefix (DEFAULT_WSDL_ENDPOINT)); m_pCall->addParameter ((void *) &Value0, cPrefixAndParamName0, XSD_INT); char cPrefixAndParamName1[17]; sprintf (cPrefixAndParamName1, "%s:arg_1_3", m_pCall->getNamespacePrefix (DEFAULT_WSDL_ENDPOINT)); m_pCall->addParameter ((void *) &Value1, cPrefixAndParamName1, XSD_INT); if (AXIS_SUCCESS == m_pCall->invoke ()) { if (AXIS_SUCCESS == m_pCall->checkMessage ("divResponse", DEFAULT_WSDL_ENDPOINT)) { Ret = m_pCall->getElementAsInt ("divReturn", 0); } } m_pCall->unInitialize (); return Ret; } catch (AxisException & e) { throw; } } /* * Methods for supporting SecureChannel */ void Calculator::SetSecure (char *pszArguments, ...) { char **ppszArgPtr = &pszArguments; int iArgIndex = 0; while (*ppszArgPtr != NULL) { sArguments[iArgIndex] = *ppszArgPtr; iArgIndex++; ppszArgPtr++; } } void Calculator::includeSecure () { m_pCall->setTransportProperty (SECURE_PROPERTIES, (const char *) &sArguments); } // Main added to allow the modified generated stub to be used as a dynamic // // client // perryan@uk.ibm.com int main (int argc, char *argv[]) { char endpoint[256]; const char *url = "http://localhost:9080/Calculator/services/Calculator"; const char *op = 0; int i1 = 100, i2 = 20; int iResult; url = argv[1]; try { sprintf (endpoint, "%s", url); Calculator ws (endpoint); iResult = ws.div (i1, i2); // Call new test method // doesn't neccessarily need to be called from main() // perryan@uk.ibm.com ws.printProtocolType (); printf ("%d\n", iResult); } catch (AxisException & e) { printf ("Exception : %s\n", e.what ()); } catch (exception & e) { printf ("Unknown exception has occured\n"); } catch (...) { printf ("Unspecified exception has occured\n"); } return 0; } 1.1 ws-axis/c/tests/auto_build/testcases/dynamic/Test01/Calculator.hpp Index: Calculator.hpp =================================================================== /* * This is a manually edited version of the Generated stub code for CaluclatorDoc.wsdl * to simplify the code to allow the cpp file to be edited to be used as a dynamic client */ // perryan@uk.ibm.com // Changed defined name to remove STUB #if !defined(__CALCULATOR_CLIENT_H__INCLUDED_) #define __CALCULATOR_CLIENT_H__INCLUDED_ #include #include // These are normally included from the generated _AxisClientException header file // so we need to specify them explicitly here // perryan@uk.ibm.com #include #include // These are normally included from the generated _AxisClientException header file // so we need to specify them explicitly here // perryan@uk.ibm.com using namespace std; AXIS_CPP_NAMESPACE_USE class Calculator { public: STORAGE_CLASS_INFO Calculator (const char *pchEndpointUri, AXIS_PROTOCOL_TYPE eProtocol = APTHTTP1_1); STORAGE_CLASS_INFO Calculator (); public: STORAGE_CLASS_INFO virtual ~ Calculator (); public: STORAGE_CLASS_INFO void SetSecure (char *, ...); STORAGE_CLASS_INFO xsd__int div (xsd__int Value0, xsd__int Value1); // Add any new test methods here. These need to be class members to get access to the // Call object. // perryan@uk.ibm.com STORAGE_CLASS_INFO void printProtocolType (void); private: void includeSecure (); Call *m_pCall; protected: std::string sArguments[8]; }; #endif /* !defined(__CALCULATOR_CLIENT_H__INCLUDED_) */ 1.1 ws-axis/c/tests/auto_build/testcases/output/DynamicTest01.expected Index: DynamicTest01.expected =================================================================== protocol type = 1 protocol type = 1 5 1.1 ws-axis/c/tests/auto_build/testcases/tests/DynamicTest01.xml Index: DynamicTest01.xml =================================================================== DynamicTest1 CalculatorDoc true Test01 cpp CalculatorDoc.wsdl DynamicTest01.expected http://localhost:80/Calculator/services/Calculator