You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2006/05/08 21:03:04 UTC
svn commit: r405132 -
/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/
Author: nadiramra
Date: Mon May 8 12:03:03 2006
New Revision: 405132
URL: http://svn.apache.org/viewcvs?rev=405132&view=rev
Log:
Cleanup test cases for creation of C test cases.
Modified:
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_stringClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_timeClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_tokenClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedByteClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedIntClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedLongClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedShortClient.cpp
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_stringClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_stringClient.cpp?rev=405132&r1=405131&r2=405132&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_stringClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_stringClient.cpp Mon May 8 12:03:03 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_string.hpp"
#include <axis/AxisException.hpp>
#include <ctype.h>
@@ -22,6 +31,16 @@
int main(int argc, char* argv[])
{
+ XSD_string* ws;
+
+ xsd__string input;
+ xsd__string result;
+
+ char emptyString[1] = "";
+ char simpleString[25] = "A simple test message!";
+ char reservedCharactersString[] = "<>&\"\'";
+ char whitespaceString[] = " \t\r\nsome text \t\r\nmore text \t\r\n";
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_string";
@@ -31,155 +50,114 @@
try
{
sprintf(endpoint, "%s", url);
- XSD_string* ws = new XSD_string(endpoint);
+ ws = new XSD_string(endpoint);
- char emptyString[1] = "";
- xsd__string emptyInput = new char[1];
- strcpy (emptyInput, emptyString);
- char simpleString[25] = "A simple test message!";
- xsd__string input = new char[25];
+ input = new char[25];
strcpy (input, simpleString);
// Test non-nillable element
- xsd__string 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, emptyString);
+
+ 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 reservedCharactersString[] = "<>&\"\'";
- xsd__string reservedCharactersInput = reservedCharactersString;
- result = ws->asNonNillableElement(reservedCharactersInput);
+ input = reservedCharactersString;
+ 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 whitespaceString[] = " \t\r\nsome text \t\r\nmore text \t\r\n";
- xsd__string whitespaceInput = whitespaceString;
- result = ws->asNonNillableElement(whitespaceInput);
+ input = whitespaceString;
+ 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, simpleString);
- xsd__string 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, emptyString);
- nillableResult = ws->asNillableElement(emptyInput);
- if (nillableResult)
+ input = new char[1];
+ strcpy (input, emptyString);
+ 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 +168,28 @@
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, emptyString);
- requiredAttributeInput;
- requiredAttributeInput.setrequiredAttribute(emptyInput);
+ input = new char[1];
+ strcpy (input, emptyString);
+ 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,40 +203,28 @@
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 optionalAttributeResult;
// Test empty optional attribute
- emptyInput = new char[1];
- strcpy (emptyInput, emptyString);
- optionalAttributeInput.setoptionalAttribute(emptyInput);
+ input = new char[1];
+ strcpy (input, emptyString);
+ 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 optionalAttributeResult;
// Test optional attribute, not present
@@ -280,63 +233,59 @@
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 arrays
- int arraySize = 2;
+#define ARRAY_SIZE 2
+ int i, outputSize=0;
+
xsd__string_Array inputArray;
- xsd__string* array = new xsd__string[arraySize];
- for (int count = 0 ; count < arraySize ; count++)
+ xsd__string_Array * arrayResult;
+ xsd__string array[ARRAY_SIZE];
+ const xsd__string* output;
+
+ for (i = 0 ; i < ARRAY_SIZE ; i++)
{
- array[count] = new char[25];
- strcpy (array[count], simpleString);
+ array[i] = new char[25];
+ strcpy (array[i], simpleString);
}
- inputArray.set(array, arraySize);
+ inputArray.set(array, ARRAY_SIZE);
+
+ arrayResult = ws->asArray(&inputArray);
+
+ if (arrayResult)
+ output = arrayResult->get(outputSize);
- xsd__string_Array * arrayResult = ws->asArray(&inputArray);
- int outputSize = 0;
- const xsd__string* output = arrayResult->get(outputSize);
cout << "array of " << outputSize << " elements" << endl;
if (output != NULL)
{
- for (int count = 0 ; count < outputSize ; count++)
+ for (i = 0 ; i < outputSize ; i++)
{
- cout << " element[" << count << "]=";
- if (output[count] != NULL)
- {
- cout << output[count] << endl;
- }
+ cout << " element[" << i << "]=";
+ if (output[i] != NULL)
+ cout << output[i] << endl;
else
- {
cout << "NULL" << endl;
- }
}
}
else
- {
cout << "NULL array" << 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
input = new char[25];
strcpy (input, simpleString);
@@ -346,18 +295,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_timeClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_timeClient.cpp?rev=405132&r1=405131&r2=405132&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_timeClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_timeClient.cpp Mon May 8 12:03:03 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_time.hpp"
#include <axis/AxisException.hpp>
#include <ctype.h>
@@ -22,6 +31,14 @@
int main(int argc, char* argv[])
{
+ XSD_time* ws;
+
+ xsd__time input;
+ xsd__time result;
+ xsd__time* nillableInput;
+ xsd__time* nillableResult;
+
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_time";
@@ -31,24 +48,23 @@
try
{
sprintf(endpoint, "%s", url);
- XSD_time* ws = new XSD_time(endpoint);
+ ws = new XSD_time(endpoint);
char returnString[50];
time_t timeToTest = 1100246323;
struct tm *temp = gmtime(&timeToTest);
- struct tm time;
- memcpy(&time, temp, sizeof(struct tm));
+ memcpy(&input, temp, sizeof(struct tm));
// Test non-nillable element
- xsd__time result = ws->asNonNillableElement(time);
+ result = ws->asNonNillableElement(input);
strftime(returnString, 50, "%H:%M:%S", &result);
cout << "non-nillable element=" << returnString << endl;
// Test nillable element, with a value
- xsd__time* nillableInput = new xsd__time();
- *(nillableInput) = time;
- xsd__time* nillableResult = ws->asNillableElement(nillableInput);
+ nillableInput = new xsd__time();
+ *(nillableInput) = input;
+ nillableResult = ws->asNillableElement(nillableInput);
if (nillableResult)
{
strftime(returnString, 50, "%H:%M:%S", nillableResult);
@@ -56,9 +72,7 @@
delete nillableResult;
}
else
- {
cout << "nillable element=<nil>" << endl;
- }
delete nillableInput;
// Test nillable element, with nil
@@ -70,13 +84,11 @@
delete nillableResult;
}
else
- {
cout << "nil element=<nil>" << endl;
- }
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
- requiredAttributeInput.setrequiredAttribute(time);
+ requiredAttributeInput.setrequiredAttribute(input);
RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
result = requiredAttributeResult->getrequiredAttribute();
strftime(returnString, 50, "%H:%M:%S", &result);
@@ -87,7 +99,7 @@
* Exact coding of this section may change depending on chosen implementation
// Test optional attribute, with a value
OptionalAttributeElement optionalAttributeInput;
- optionalAttributeInput.setoptionalAttribute(time);
+ optionalAttributeInput.setoptionalAttribute(input);
OptionalAttributeElement* optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
if (optionalAttributeResult->getoptionalAttribute())
{
@@ -95,9 +107,7 @@
cout << "optional attribute, with data=" << returnString << endl;
}
else
- {
cout << "optional attribute, with data=<not present>" << endl;
- }
delete optionalAttributeResult;
// Test optional attribute, not present
@@ -109,43 +119,45 @@
cout << "optional attribute, not present=" << returnString << endl;
}
else
- {
cout << "optional attribute, not present=<not present>" << endl;
- }
delete optionalAttributeResult;
*/
// Test array
- xsd__time_Array arrayInput;
- int arraySize = 2;
- xsd__time ** array = new xsd__time*[arraySize];
+#define ARRAY_SIZE 2
+ int i, outputSize=0;
- for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
- {
- array[inputIndex] = new xsd__time(time);
- }
- arrayInput.set(array,arraySize);
- xsd__time_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize=0;
- const xsd__time ** output = arrayResult->get(outputSize);
+ xsd__time_Array arrayInput;
+ xsd__time_Array* arrayResult;
+ xsd__time * array[ARRAY_SIZE];
+ const xsd__time ** output;
+
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ array[i] = new xsd__time(input);
+ 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++)
- {
- strftime(returnString, 50, "%H:%M:%S", output[index]);
- cout << " element[" << index << "]=" << returnString << endl;
-
- }
- // Clear up input array
- for (int deleteIndex = 0 ; deleteIndex < arraySize ; deleteIndex++ )
+ for (i = 0; i < outputSize ; i++)
{
- delete array[deleteIndex];
+ strftime(returnString, 50, "%H:%M:%S", output[i]);
+ cout << " element[" << i << "]=" << returnString << endl;
}
- delete [] array;
+
+ // Clear up input array
+ for (i = 0 ; i < ARRAY_SIZE ; i++ )
+ delete array[i];
delete arrayResult;
+
+
+
// Test complex type
SimpleComplexType complexTypeInput;
- complexTypeInput.setcomplexTypeElement(time);
+ complexTypeInput.setcomplexTypeElement(input);
SimpleComplexType* complexTypeResult = ws->asComplexType(&complexTypeInput);
result = complexTypeResult->getcomplexTypeElement();
strftime(returnString, 50, "%H:%M:%S", &result);
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_tokenClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_tokenClient.cpp?rev=405132&r1=405131&r2=405132&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_tokenClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_tokenClient.cpp Mon May 8 12:03:03 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_token.hpp"
#include <axis/AxisException.hpp>
#include <ctype.h>
@@ -22,6 +31,16 @@
int main(int argc, char* argv[])
{
+ XSD_token* ws ;
+
+ xsd__token input;
+ xsd__token result;
+
+ char emptytoken[1] = "";
+ char simpletoken[25] = "A simple test message!";
+ char reservedCharacterstoken[] = "<>&\"\'";
+ char whitespacetoken[] = " \t\r\nsome text \t\r\nmore text \t\r\n";
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_token";
@@ -31,114 +50,81 @@
try
{
sprintf(endpoint, "%s", url);
- XSD_token* ws = new XSD_token(endpoint);
+ ws = new XSD_token(endpoint);
- char emptytoken[1] = "";
- xsd__token emptyInput = new char[1];
- strcpy (emptyInput, emptytoken);
- char simpletoken[25] = "A simple test message!";
- xsd__token input = new char[25];
+ input = new char[25];
strcpy (input, simpletoken);
// Test non-nillable element
- xsd__token 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 non-nillable element with XML reserved characters
- char reservedCharacterstoken[] = "<>&\"\'";
- xsd__token reservedCharactersInput = reservedCharacterstoken;
- result = ws->asNonNillableElement(reservedCharactersInput);
+ input = reservedCharacterstoken;
+ 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 whitespacetoken[] = " \t\r\nsome text \t\r\nmore text \t\r\n";
- xsd__token whitespaceInput = whitespacetoken;
- result = ws->asNonNillableElement(whitespaceInput);
+ input = whitespacetoken;
+ 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, simpletoken);
- xsd__token 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 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];
@@ -149,18 +135,12 @@
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;
@@ -191,26 +171,20 @@
delete optionalAttributeResult;
// Test empty optional attribute
- emptyInput = new char[1];
- strcpy (emptyInput, emptytoken);
- optionalAttributeInput.setoptionalAttribute(emptyInput);
+ input = new char[1];
+ strcpy (input, emptytoken);
+ 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
@@ -235,46 +209,49 @@
*/
// Test array
+#define ARRAY_SIZE 2
+ int i, outputSize=0;
+
xsd__token_Array arrayInput;
- int arraySize=2;
- xsd__token * array = new xsd__token[arraySize];
- for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
- {
- array[inputIndex]= new char[25];
- strcpy (array[inputIndex], simpletoken);
- }
- arrayInput.set(array,arraySize);
- xsd__token_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize=0;
- const xsd__token * output = arrayResult->get(outputSize);
+ xsd__token_Array* arrayResult;
+ xsd__token array[ARRAY_SIZE];
+ const xsd__token * output;
+
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ {
+ array[i]= new char[25];
+ strcpy (array[i], simpletoken);
+ }
+ 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;
+
+ // Clear up input array
+ for (i = 0 ; i < ARRAY_SIZE ; i++ )
+ delete [] array[i];
delete arrayResult;
+
+
+
+
+
// Test complex type
input = new char[25];
strcpy (input, simpletoken);
@@ -284,18 +261,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_unsignedByteClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedByteClient.cpp?rev=405132&r1=405131&r2=405132&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedByteClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedByteClient.cpp Mon May 8 12:03:03 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_unsignedByte.hpp"
#include <axis/AxisException.hpp>
#include <ctype.h>
@@ -21,39 +30,43 @@
int main(int argc, char* argv[])
{
+ XSD_unsignedByte* ws;
+
+ xsd__unsignedByte result;
+ xsd__unsignedByte* nillableInput;
+ xsd__unsignedByte* nillableResult;
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_unsignedByte";
if(argc>1)
url = argv[1];
- // bool bSuccess = false;
-
try
{
sprintf(endpoint, "%s", url);
- XSD_unsignedByte* ws = new XSD_unsignedByte(endpoint);
+ ws = new XSD_unsignedByte(endpoint);
- xsd__unsignedByte result = ws->asNonNillableElement((xsd__unsignedByte)255);
+ result = ws->asNonNillableElement((xsd__unsignedByte)255);
cout << "non-nillable element=" << (int) result << endl;
+
result = ws->asNonNillableElement((xsd__unsignedByte)1);
cout << "non-nillable element=" << (int) result << endl;
+
result = ws->asNonNillableElement((xsd__unsignedByte)0);
cout << "non-nillable element=" << (int) result << endl;
// Test nillable element, with a value
- xsd__unsignedByte* nillableInput = new xsd__unsignedByte();
+ nillableInput = new xsd__unsignedByte();
*(nillableInput) = (xsd__unsignedByte)123;
- xsd__unsignedByte* nillableResult = ws->asNillableElement(nillableInput);
+ nillableResult = ws->asNillableElement(nillableInput);
if (nillableResult)
{
cout << "nillable element=" << (int) *(nillableResult) << endl;
delete nillableResult;
}
else
- {
cout << "nillable element=<nil>" << endl;
- }
delete nillableInput;
// Test nillable element, with nil
@@ -64,9 +77,7 @@
delete nillableResult;
}
else
- {
cout << "nil element=<nil>" << endl;
- }
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
@@ -82,57 +93,50 @@
optionalAttributeInput.setoptionalAttribute(123);
OptionalAttributeElement* optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
if (optionalAttributeResult->getoptionalAttribute())
- {
cout << "optional attribute, with data=" << (int) 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=" << (int) 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__unsignedByte_Array arrayInput;
- int arraySize=2;
- xsd__unsignedByte ** array = new xsd__unsignedByte*[arraySize];
+ xsd__unsignedByte_Array* arrayResult;
+ xsd__unsignedByte * array[ARRAY_SIZE];
+ const xsd__unsignedByte ** output;
- for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
- {
- array[inputIndex] = new xsd__unsignedByte(123);
-
- }
- arrayInput.set(array,arraySize);
- xsd__unsignedByte_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize=0;
- const xsd__unsignedByte ** output = arrayResult->get(outputSize);
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ array[i] = new xsd__unsignedByte(123);
+ 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 << "]=" << (int) *((xsd__unsignedByte*)(output[index])) << endl;
-
- }
+ for (i = 0; i < outputSize ; i++)
+ cout << " element[" << i << "]=" << (int) *((xsd__unsignedByte*)(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
SimpleComplexType complexTypeInput;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedIntClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedIntClient.cpp?rev=405132&r1=405131&r2=405132&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedIntClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedIntClient.cpp Mon May 8 12:03:03 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_unsignedInt.hpp"
#include <axis/AxisException.hpp>
#include <ctype.h>
@@ -21,6 +30,13 @@
int main(int argc, char* argv[])
{
+ XSD_unsignedInt* ws;
+
+ xsd__unsignedInt result;
+ xsd__unsignedInt* nillableInput;
+ xsd__unsignedInt* nillableResult;
+
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_unsignedInt";
@@ -32,9 +48,9 @@
try
{
sprintf(endpoint, "%s", url);
- XSD_unsignedInt* ws = new XSD_unsignedInt(endpoint);
+ ws = new XSD_unsignedInt(endpoint);
- xsd__unsignedInt result = ws->asNonNillableElement((xsd__unsignedInt)4294967295);
+ result = ws->asNonNillableElement((xsd__unsignedInt)4294967295);
cout << "non-nillable element=" << result << endl;
result = ws->asNonNillableElement((xsd__unsignedInt)1);
cout << "non-nillable element=" << result << endl;
@@ -43,18 +59,16 @@
// Test nillable element, with a value
- xsd__unsignedInt* nillableInput = new xsd__unsignedInt();
+ nillableInput = new xsd__unsignedInt();
*(nillableInput) = (xsd__unsignedInt)123456789;
- xsd__unsignedInt* 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
@@ -65,9 +79,7 @@
delete nillableResult;
}
else
- {
cout << "nil element=<nil>" << endl;
- }
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
@@ -83,55 +95,45 @@
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__unsignedInt_Array arrayInput;
- int arraySize = 2;
- xsd__unsignedInt ** array =new xsd__unsignedInt*[arraySize];
+ xsd__unsignedInt_Array* arrayResult;
+ xsd__unsignedInt * array[ARRAY_SIZE];
+ const xsd__unsignedInt ** output;
- for (int inputIndex=0 ; inputIndex < arraySize; inputIndex++)
- {
- array[inputIndex] = new xsd__unsignedInt(123456789);
-
- }
- arrayInput.set(array,arraySize);
- xsd__unsignedInt_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize=0;
- const xsd__unsignedInt ** output =arrayResult->get(outputSize);
+ for (i=0 ; i < ARRAY_SIZE; i++)
+ array[i] = new xsd__unsignedInt(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__unsignedInt*)(output[index])) << endl;
-
- }
+ for (i = 0; i < outputSize ; i++)
+ cout << " element[" << i << "]=" << *((xsd__unsignedInt*)(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;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedLongClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedLongClient.cpp?rev=405132&r1=405131&r2=405132&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedLongClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedLongClient.cpp Mon May 8 12:03:03 2006
@@ -13,6 +13,15 @@
// See the License for the specific language governing permissions and
// 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_unsignedLong.hpp"
#include <axis/AxisException.hpp>
@@ -22,6 +31,12 @@
int main(int argc, char* argv[])
{
+ XSD_unsignedLong* ws;
+
+ xsd__unsignedLong result;
+ xsd__unsignedLong* nillableInput;
+ xsd__unsignedLong* nillableResult;
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_unsignedLong";
@@ -33,29 +48,29 @@
try
{
sprintf(endpoint, "%s", url);
- XSD_unsignedLong* ws = new XSD_unsignedLong(endpoint);
+ ws = new XSD_unsignedLong(endpoint);
- xsd__unsignedLong result = ws->asNonNillableElement((xsd__unsignedLong) UNSIGNED_LONGLONGVALUE(18446744073709551615));
+ result = ws->asNonNillableElement((xsd__unsignedLong) UNSIGNED_LONGLONGVALUE(18446744073709551615));
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__unsignedLong)1);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__unsignedLong)0);
cout << "non-nillable element=" << result << endl;
// Test nillable element, with a value
- xsd__unsignedLong* nillableInput = new xsd__unsignedLong();
+ nillableInput = new xsd__unsignedLong();
*(nillableInput) = (xsd__unsignedLong)123456789;
- xsd__unsignedLong* 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
@@ -66,9 +81,7 @@
delete nillableResult;
}
else
- {
cout << "nil element=<nil>" << endl;
- }
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
@@ -84,57 +97,50 @@
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__unsignedLong_Array arrayInput;
- int arraySize =2;
- xsd__unsignedLong ** array = new xsd__unsignedLong*[arraySize];
+ xsd__unsignedLong_Array* arrayResult;
+ xsd__unsignedLong * array[ARRAY_SIZE];
+ const xsd__unsignedLong ** output;
- for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
- {
- array[inputIndex] = new xsd__unsignedLong(123456789);
-
- }
- arrayInput.set(array,arraySize);
- xsd__unsignedLong_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize =0;
- const xsd__unsignedLong ** output = arrayResult->get(outputSize);
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ array[i] = new xsd__unsignedLong(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__unsignedLong*)(output[index])) << endl;
-
- }
+ for (i = 0; i < outputSize ; i++)
+ cout << " element[" << i << "]=" << *((xsd__unsignedLong*)(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
SimpleComplexType complexTypeInput;
complexTypeInput.setcomplexTypeElement(123456789);
@@ -142,8 +148,8 @@
cout << "within complex type=" << complexTypeResult->getcomplexTypeElement() << endl;
delete complexTypeResult;
- // Tests now complete
- delete ws;
+ // Tests now complete
+ delete ws;
}
catch(AxisException& e)
{
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedShortClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedShortClient.cpp?rev=405132&r1=405131&r2=405132&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedShortClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_unsignedShortClient.cpp Mon May 8 12:03:03 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_unsignedShort.hpp"
#include <axis/AxisException.hpp>
#include <ctype.h>
@@ -21,6 +30,13 @@
int main(int argc, char* argv[])
{
+ XSD_unsignedShort* ws;
+
+ xsd__unsignedShort result;
+ xsd__unsignedShort* nillableInput;
+ xsd__unsignedShort* nillableResult;
+
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_unsignedShort";
@@ -32,29 +48,29 @@
try
{
sprintf(endpoint, "%s", url);
- XSD_unsignedShort* ws = new XSD_unsignedShort(endpoint);
+ ws = new XSD_unsignedShort(endpoint);
- xsd__unsignedShort result = ws->asNonNillableElement((xsd__unsignedShort)65535);
+ result = ws->asNonNillableElement((xsd__unsignedShort)65535);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__unsignedShort)1);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__unsignedShort)0);
cout << "non-nillable element=" << result << endl;
// Test nillable element, with a value
- xsd__unsignedShort* nillableInput = new xsd__unsignedShort();
+ nillableInput = new xsd__unsignedShort();
*(nillableInput) = (xsd__unsignedShort)12345;
- xsd__unsignedShort* 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
@@ -65,9 +81,7 @@
delete nillableResult;
}
else
- {
cout << "nil element=<nil>" << endl;
- }
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
@@ -83,55 +97,46 @@
optionalAttributeInput.setoptionalAttribute(12345);
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__unsignedShort_Array arrayInput;
- int arraySize=2;
- xsd__unsignedShort ** array = new xsd__unsignedShort*[arraySize];
+ xsd__unsignedShort_Array* arrayResult;
+ xsd__unsignedShort * array[ARRAY_SIZE];
+ const xsd__unsignedShort ** output;
+
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ array[i] = new xsd__unsignedShort(12345);
+ arrayInput.set(array,ARRAY_SIZE);
+
+ arrayResult = ws->asArray(&arrayInput);
+
+ if (arrayResult)
+ output = arrayResult->get(outputSize);
- for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
- {
- array[inputIndex] = new xsd__unsignedShort(12345);
-
- }
- arrayInput.set(array,arraySize);
- xsd__unsignedShort_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize = 0;
- const xsd__unsignedShort ** output = arrayResult->get(outputSize);
cout << "array of " << outputSize << " elements" << endl;
- for (int index = 0; index < outputSize ; index++)
- {
- cout << " element[" << index << "]=" << *((xsd__unsignedShort*)(output[index])) << endl;
-
- }
+ for (i = 0; i < outputSize ; i++)
+ cout << " element[" << i << "]=" << *((xsd__unsignedShort*)(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