axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r405139 - in /webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp: XSD_QNameClient.cpp XSD_positiveIntegerClient.cpp
Date Mon, 08 May 2006 19:20:08 GMT
Author: nadiramra
Date: Mon May  8 12:20:05 2006
New Revision: 405139

URL: http://svn.apache.org/viewcvs?rev=405139&view=rev
Log:
Cleanup test cases for creation of C test cases.

Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_QNameClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_positiveIntegerClient.cpp

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_QNameClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_QNameClient.cpp?rev=405139&r1=405138&r2=405139&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_QNameClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_QNameClient.cpp Mon
May  8 12:20:05 2006
@@ -14,6 +14,15 @@
 // limitations under the License.
 
 
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE   */
+/* ----------------------------------------------------------------   */
+/* CHANGES TO THIS FILE MAY ALSO REQUIRE CHANGES TO THE               */
+/* C-EQUIVALENT FILE. PLEASE ENSURE THAT IT IS DONE.                  */
+/* ----------------------------------------------------------------   */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE   */
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
 #include "XSD_QName.hpp"
 #include <axis/AxisException.hpp>
 #include <ctype.h>
@@ -22,6 +31,16 @@
 
 int main(int argc, char* argv[])
 {
+    XSD_QName* ws;
+    
+    xsd__QName input;
+    xsd__QName result;
+    
+    char emptyQName[1] = "";
+    char simpleQName[25] = "A simple test message!";
+    char reservedCharactersQName[] = "<>&\"\'";
+    char whitespaceQName[] = "  \t\r\nsome text \t\r\nmore text \t\r\n";
+    
     char endpoint[256];
     const char* url="http://localhost:80/axis/XSD_QName";
 
@@ -31,155 +50,120 @@
     try
     {
         sprintf(endpoint, "%s", url);
-        XSD_QName* ws = new XSD_QName(endpoint);
-      
-        char emptyQName[1] = "";
-        xsd__QName emptyInput = new char[1];
-        strcpy (emptyInput, emptyQName);
-        char simpleQName[25] = "A simple test message!";
-        xsd__QName input = new char[25];
+        ws = new XSD_QName(endpoint);
+              
+        input = new char[25];
         strcpy (input, simpleQName);
 
         // Test non-nillable element
-        xsd__QName result = ws->asNonNillableElement(input);
+        result = ws->asNonNillableElement(input);
         if (result)
         {
             if (*result)
-            {
                 cout << "non-nillable element=" << result << endl;
-            }
             else
-            {
                 cout << "non-nillable element=<empty>" << endl;
-            }
+                
+            delete result;
         }
         else
-        {
             cout << "non-nillable element=<nil>" << endl;
-        }
         delete [] input;
 
         // Test empty non-nillable element
-        result = ws->asNonNillableElement(emptyInput);
+        input = new char[1];
+        strcpy (input, emptyQName);
+        
+        result = ws->asNonNillableElement(input);
         if (result)
         {
             if (*result)
-            {
                 cout << "empty non-nillable element=" << result << endl;
-            }
             else
-            {
                 cout << "empty non-nillable element=<empty>" << endl;
-            }
+                
+            delete result;
         }
         else
-        {
             cout << "empty non-nillable element=<nil>" << endl;
-        }
-        delete [] emptyInput;
+        delete [] input;
 
         // Test non-nillable element with XML reserved characters
-        char reservedCharactersQName[] = "<>&\"\'";
-        xsd__QName reservedCharactersInput = reservedCharactersQName;
-        result = ws->asNonNillableElement(reservedCharactersInput);
+        
+        input = reservedCharactersQName;
+        result = ws->asNonNillableElement(input);
         if (result)
         {
             if (*result)
-            {
                 cout << "non-nillable element with XML reserved characters=" <<
result << endl;
-            }
             else
-            {
                 cout << "non-nillable element with XML reserved characters=<empty>"
<< endl;
-            }
+                
+            delete result;
         }
         else
-        {
             cout << "non-nillable element with XML reserved characters=<nil>"
<< endl;
-        }
 
         // Test non-nillable element with XML reserved characters
-        char whitespaceQName[] = "  \t\r\nsome text \t\r\nmore text \t\r\n";
-        xsd__QName whitespaceInput = whitespaceQName;
-        result = ws->asNonNillableElement(whitespaceInput);
+        
+        input = whitespaceQName;
+        result = ws->asNonNillableElement(input);
         if (result)
         {
             if (*result)
-            {
                 cout << "non-nillable element with whitespace characters=\"" <<
result << "\"" << endl;
-            }
             else
-            {
                 cout << "non-nillable element with whitespace characters=<empty>"
<< endl;
-            }
+                
+            delete result;
         }
         else
-        {
             cout << "non-nillable element with whitespace characters=<nil>" <<
endl;
-        }
 
         // Test nillable element, with a value
         input = new char[25];
         strcpy (input, simpleQName);
-        xsd__QName nillableResult = ws->asNillableElement(input);
-        if (nillableResult)
+        result = ws->asNillableElement(input);
+        if (result)
         {
-            if (*nillableResult)
-            {
-                cout << "nillable element=" << nillableResult << endl;
-            }
+            if (*result)
+                cout << "nillable element=" << result << endl;
             else
-            {
                 cout << "nillable element=<empty>" << endl;
-            }
-            delete nillableResult;
+            delete result;
         }
         else
-        {
             cout << "nillable element=<nil>" << endl;
-        }
         delete [] input;
 
         // Test empty nillable element
-        emptyInput = new char[1];
-        strcpy (emptyInput, emptyQName);
-        nillableResult = ws->asNillableElement(emptyInput);
-        if (nillableResult)
+        input = new char[1];
+        strcpy (input, emptyQName);
+        result = ws->asNillableElement(input);
+        if (result)
         {
-            if (*nillableResult)
-            {
-                cout << "empty nillable element=" << nillableResult <<
endl;
-            }
+            if (*result)
+                cout << "empty nillable element=" << result << endl;
             else
-            {
                 cout << "empty nillable element=<empty>" << endl;
-            }
-            delete nillableResult;
+            delete result;
         }
         else
-        {
             cout << "empty nillable element=<nil>" << endl;
-        }
-        delete [] emptyInput;
+        delete [] input;
 
         // Test nillable element, with nil
-        nillableResult = ws->asNillableElement(NULL);
-        if (nillableResult)
+        result = ws->asNillableElement(NULL);
+        if (result)
         {
-            if (*nillableResult)
-            {
-                cout << "nil element=" << nillableResult << endl;
-            }
+            if (*result)
+                cout << "nil element=" << result << endl;
             else
-            {
                 cout << "nil element=<empty>" << endl;
-            }
-            delete nillableResult;
+            delete result;
         }
         else
-        {
             cout << "nil element=<nil>" << endl;
-        }
 
         // Test required attribute
         input = new char[25];
@@ -190,41 +174,29 @@
         if (requiredAttributeResult->getrequiredAttribute())
         {
             if (*(requiredAttributeResult->getrequiredAttribute()))
-            {
                 cout << "required attribute=" << requiredAttributeResult->getrequiredAttribute()
<< endl;
-            }
             else
-            {
                 cout << "required attribute=<empty>" << endl;
-            }
         }
         else
-        {
             cout << "required attribute=<nil>" << endl;
-        }
         delete requiredAttributeResult;
 
         // Test empty required attribute
-        emptyInput = new char[1];
-        strcpy (emptyInput, emptyQName);
+        input = new char[1];
+        strcpy (input, emptyQName);
         requiredAttributeInput;
-        requiredAttributeInput.setrequiredAttribute(emptyInput);
+        requiredAttributeInput.setrequiredAttribute(input);
         requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
         if (requiredAttributeResult->getrequiredAttribute())
         {
             if (*(requiredAttributeResult->getrequiredAttribute()))
-            {
                 cout << "empty required attribute=" << requiredAttributeResult->getrequiredAttribute()
<< endl;
-            }
             else
-            {
                 cout << "empty required attribute=<empty>" << endl;
-            }
         }
         else
-        {
             cout << "empty required attribute=<nil>" << endl;
-        }
         delete requiredAttributeResult;
 
 /* Optional Attributes currently unsupported by WSDL2Ws
@@ -238,42 +210,32 @@
         if (optionalAttributeResult->getoptionalAttribute())
         {
             if (*(optionalAttributeResult->getoptionalAttribute()))
-            {
                 cout << "optional attribute, with data=" << optionalAttributeResult->getoptionalAttribute()
<< endl;
-            }
             else
-            {
                 cout << "optional attribute, with data=<empty>" << endl;
-            }
         }
         else
-        {
             cout << "optional attribute, with data=<not present>" << endl;
-        }
         delete [] input;
         delete optionalAttributeResult;
 
         // Test empty optional attribute
-        emptyInput = new char[1];
-        strcpy (emptyInput, emptyQName);
-        optionalAttributeInput.setoptionalAttribute(emptyInput);
+        input = new char[1];
+        strcpy (input, emptyQName);
+        optionalAttributeInput.setoptionalAttribute(input);
         optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
         if (optionalAttributeResult->getoptionalAttribute())
         {
             if (*(optionalAttributeResult->getoptionalAttribute()))
-            {
                 cout << "empty optional attribute=" << optionalAttributeResult->getoptionalAttribute()
<< endl;
-            }
             else
-            {
                 cout << "empty optional attribute=<empty>" << endl;
-            }
         }
         else
         {
             cout << "empty optional attribute=<not present>" << endl;
         }
-        delete [] emptyInput;
+        delete [] input;
         delete optionalAttributeResult;
 
         // Test optional attribute, not present
@@ -282,61 +244,52 @@
         if (optionalAttributeResult->getoptionalAttribute())
         {
             if (*(optionalAttributeResult->getoptionalAttribute()))
-            {
                 cout << "optional attribute, not present=" << optionalAttributeResult->getoptionalAttribute()
<< endl;
-            }
             else
-            {
                 cout << "optional attribute, not present=<empty>" << endl;
-            }
         }
         else
-        {
             cout << "optional attribute, not present=<not present>" <<
endl;
-        }
         delete optionalAttributeResult;
 */
 
         // Test array
+#define ARRAY_SIZE 2                    
+       int i, outputSize=0;
+        
        xsd__QName_Array arrayInput;
-                int arraySize=2;
-                xsd__QName *array = new xsd__QName[arraySize];
-        for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
-        {
-            array[inputIndex] = new char[25];
-            strcpy (array[inputIndex], simpleQName);            
-        }
-                arrayInput.set(array,arraySize);
-        xsd__QName_Array* arrayResult = ws->asArray(&arrayInput);
-                int outputSize=0;
-                const xsd__QName *output = arrayResult->get(outputSize);
+       xsd__QName_Array* arrayResult;
+       xsd__QName array[ARRAY_SIZE];
+       const xsd__QName *output;
+       
+        for (i=0 ; i < ARRAY_SIZE ; i++)
+        {
+            array[i] = new char[25];
+            strcpy (array[i], simpleQName);            
+        }
+        arrayInput.set(array,ARRAY_SIZE);
+        
+        arrayResult = ws->asArray(&arrayInput);
+        
+        if (arrayResult)
+           output = arrayResult->get(outputSize);
         cout << "array of " << outputSize << " elements" << endl;
-        for (int index = 0; index < outputSize ; index++)
+        for (i = 0; i < outputSize ; i++)
         {
             if (output!=NULL)
             {
-                if (output[index]!=NULL)
-                {
-                    cout << "  element[" << index << "]=" << output[index]
<< endl;
-                }
+                if (output[i]!=NULL)
+                    cout << "  element[" << i << "]=" << output[i]
<< endl;
                 else
-                {
-                    cout << "  element[" << index << "]=<empty>"
<< endl;
-                }
-                
+                    cout << "  element[" << i << "]=<empty>" <<
endl;
             }
             else
-            {
-                cout << "  element[" << index << "]=<nil>" <<
endl;
-            }
+                cout << "  element[" << i << "]=<nil>" << endl;
         }
 
                 // Clear up input array        
-        for (int deleteIndex = 0 ; deleteIndex < arraySize ; deleteIndex++ )
-        {
-            delete array[deleteIndex];
-        }
-        delete [] array;
+        for (i = 0 ; i < ARRAY_SIZE ; i++ )
+            delete array[i];
         delete arrayResult;
 
 
@@ -349,18 +302,12 @@
         if (complexTypeResult->getcomplexTypeElement())
         {
             if (*(complexTypeResult->getcomplexTypeElement()))
-            {
                 cout << "within complex type=" << complexTypeResult->getcomplexTypeElement()
<< endl;
-            }
             else
-            {
                 cout << "within complex type=<empty>" << endl;
-            }
         }
         else
-        {
             cout << "within complex type=<nil>" << endl;
-        }
         delete complexTypeResult;
 
         // Tests now complete

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_positiveIntegerClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_positiveIntegerClient.cpp?rev=405139&r1=405138&r2=405139&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_positiveIntegerClient.cpp
(original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_positiveIntegerClient.cpp
Mon May  8 12:20:05 2006
@@ -14,6 +14,15 @@
 // limitations under the License.
 
 
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE   */
+/* ----------------------------------------------------------------   */
+/* CHANGES TO THIS FILE MAY ALSO REQUIRE CHANGES TO THE               */
+/* C-EQUIVALENT FILE. PLEASE ENSURE THAT IT IS DONE.                  */
+/* ----------------------------------------------------------------   */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE   */
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
 #include "XSD_positiveInteger.hpp"
 #include <axis/AxisException.hpp>
 #include <ctype.h>
@@ -22,22 +31,30 @@
 
 int main(int argc, char* argv[])
 {
+    XSD_positiveInteger* ws;
+
+    xsd__positiveInteger result;
+    xsd__positiveInteger* nillableInput;
+    xsd__positiveInteger* nillableResult;
+    
+    
     char endpoint[256];
     const char* url="http://localhost:80/axis/XSD_positiveInteger";
 
     if(argc>1)
         url = argv[1];
 
-      // bool bSuccess = false;
-
     try
     {
         sprintf(endpoint, "%s", url);
-        XSD_positiveInteger* ws = new XSD_positiveInteger(endpoint);
-        xsd__positiveInteger result = ws->asNonNillableElement((xsd__positiveInteger)
UNSIGNED_LONGLONGVALUE(18446744073709551615));
+        ws = new XSD_positiveInteger(endpoint);
+        
+        result = ws->asNonNillableElement((xsd__positiveInteger) UNSIGNED_LONGLONGVALUE(18446744073709551615));
         cout << "non-nillable element=" << result << endl;
+        
         result = ws->asNonNillableElement((xsd__positiveInteger)1);
         cout << "non-nillable element=" << result << endl;
+        
         try
         {
             result = ws->asNonNillableElement((xsd__positiveInteger)0);
@@ -50,18 +67,16 @@
 
 
         // Test nillable element, with a value
-        xsd__positiveInteger* nillableInput = new xsd__positiveInteger();
+        nillableInput = new xsd__positiveInteger();
         *(nillableInput) = (xsd__positiveInteger)123456789;
-        xsd__positiveInteger* nillableResult = ws->asNillableElement(nillableInput);
+        nillableResult = ws->asNillableElement(nillableInput);
         if (nillableResult)
         {
             cout << "nillable element=" << *(nillableResult) << endl;
             delete nillableResult;
         }
         else
-        {
             cout << "nillable element=<nil>" << endl;
-        }
         delete nillableInput;
 
         // Test nillable element, with nil
@@ -72,9 +87,7 @@
             delete nillableResult;
         }
         else
-        {
             cout << "nil element=<nil>" << endl;
-        }
 
         // Test required attribute
         RequiredAttributeElement requiredAttributeInput;
@@ -90,55 +103,46 @@
         optionalAttributeInput.setoptionalAttribute(123456789);
         OptionalAttributeElement* optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
         if (optionalAttributeResult->getoptionalAttribute())
-        {
             cout << "optional attribute, with data=" << optionalAttributeResult->getoptionalAttribute()
<< endl;
-        }
         else
-        {
             cout << "optional attribute, with data=<not present>" << endl;
-        }
         delete optionalAttributeResult;
 
         // Test optional attribute, not present
         optionalAttributeInput.setattribute();
         optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
         if (optionalAttributeResult->getoptionalAttribute())
-        {
             cout << "optional attribute, not present=" << optionalAttributeResult->getoptionalAttribute()
<< endl;
-        }
         else
-        {
             cout << "optional attribute, not present=<not present>" <<
endl;
-        }
         delete optionalAttributeResult;
 */
 
         // Test array
+#define ARRAY_SIZE 2                    
+        int i, outputSize=0;
+        
         xsd__positiveInteger_Array arrayInput;
-                int arraySize=2;
-                xsd__positiveInteger ** array = new xsd__positiveInteger*[arraySize];
+        xsd__positiveInteger_Array* arrayResult;
+        xsd__positiveInteger * array[ARRAY_SIZE];
+        const xsd__positiveInteger ** output;
         
-        for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
-        {
-            array[inputIndex] = new xsd__positiveInteger(123456789);
-           
-        }
-                arrayInput.set(array,arraySize);
-        xsd__positiveInteger_Array* arrayResult = ws->asArray(&arrayInput);
-                int outputSize=0;
-                const xsd__positiveInteger ** output=arrayResult->get(outputSize);
+        for (i=0 ; i < ARRAY_SIZE ; i++)
+            array[i] = new xsd__positiveInteger(123456789);
+        
+        arrayInput.set(array,ARRAY_SIZE);
+        
+        arrayResult = ws->asArray(&arrayInput);
+
+        if (arrayResult)
+            output=arrayResult->get(outputSize);
         cout << "array of " << outputSize << " elements" << endl;
-        for (int index = 0; index < outputSize; index++)
-        {
-            cout << "  element[" << index << "]=" << *((xsd__positiveInteger*)(output[index]))
<< endl;
-          
-        }
+        for (i = 0; i < outputSize; i++)
+            cout << "  element[" << i << "]=" << *((xsd__positiveInteger*)(output[i]))
<< endl;
+
         // Clear up input array        
-        for (int deleteIndex = 0 ; deleteIndex < arraySize ; deleteIndex++ )
-        {
-            delete array[deleteIndex];
-        }
-        delete [] array;
+        for (i = 0 ; i < ARRAY_SIZE ; i++ )
+            delete array[i];
         delete arrayResult;
 
         // Test complex type



Mime
View raw message