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/09 06:30:55 UTC
svn commit: r405301 - in
/webservices/axis/trunk/c/tests/auto_build/testcases:
client/c/XSD_negativeIntegerClient.c client/cpp/XSD_NCNameClient.cpp
client/cpp/XSD_negativeIntegerClient.cpp tests/XSD_negativeIntegerC.xml
Author: nadiramra
Date: Mon May 8 21:30:54 2006
New Revision: 405301
URL: http://svn.apache.org/viewcvs?rev=405301&view=rev
Log:
C support fixes/enhancements. Testcases for C bindings.
Added:
webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_negativeIntegerClient.c
webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_negativeIntegerC.xml
Modified:
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_NCNameClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_negativeIntegerClient.cpp
Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_negativeIntegerClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_negativeIntegerClient.c?rev=405301&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_negativeIntegerClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_negativeIntegerClient.c Mon May 8 21:30:54 2006
@@ -0,0 +1,167 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "CommonClientTestCode.h"
+#include "XSD_negativeInteger.h"
+
+
+int main(int argc, char* argv[])
+{
+ AXISCHANDLE ws;
+
+ xsdc__negativeInteger result;
+ xsdc__negativeInteger input;
+ xsdc__negativeInteger* nillableResult;
+
+ char endpoint[256];
+ const char* url="http://localhost:80/axis/XSD_negativeInteger";
+
+ if(argc>1)
+ url = argv[1];
+
+ sprintf(endpoint, "%s", url);
+ ws = get_XSD_negativeInteger_stub(endpoint);
+
+ result = asNonNillableElement(ws, (xsdc__negativeInteger) LONGLONGVALUE(-9223372036854775808));
+ printf( "non-nillable element=%lld\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__negativeInteger)-1);
+ printf( "non-nillable element=%lld\n" , result );
+
+
+ result = asNonNillableElement(ws, (xsdc__negativeInteger)0);
+ if (!(exceptionOccurred == C_TRUE
+ || get_XSD_negativeInteger_Status(ws) == AXISC_FAIL ))
+ {
+ printf("non-nillable element=%llu\n" , result );
+ exceptionOccurred = C_FALSE;
+ }
+
+ /*
+ * Test client correctly handles server response data beginning with '-'
+ * which is also permitted for nonPositiveInteger.
+ */
+ result = asNonNillableElement(ws, (xsdc__negativeInteger)-123456789);
+ printf( "non-nillable element=%lld\n" , result );
+
+ // Test nillable element, with a value
+ input = (xsdc__negativeInteger)-123456789;
+ nillableResult = asNillableElement(ws, &input);
+ if (nillableResult)
+ {
+ printf( "nillable element=%lld\n" , *(nillableResult) );
+ axiscAxisDelete(nillableResult, XSDC_NEGATIVEINTEGER);
+ }
+ else
+ printf( "nillable element=<nil>\n" );
+
+ // Test nillable element, with nil
+ nillableResult = asNillableElement(ws, NULL);
+ if (nillableResult)
+ {
+ printf( "nil element=%lld\n" , *(nillableResult) );
+ axiscAxisDelete(nillableResult, XSDC_NEGATIVEINTEGER);
+ }
+ else
+ printf( "nil element=<nil>\n" );
+
+ // Test required attribute
+ {
+ RequiredAttributeElement requiredAttributeInput;
+ RequiredAttributeElement* requiredAttributeResult;
+
+ requiredAttributeInput.requiredAttribute = -123456789;
+ requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+ printf( "required attribute=%lld\n" , requiredAttributeResult->requiredAttribute );
+ Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
+ }
+
+/* Optional Attributes currently unsupported by WSDL2Ws
+ * Exact coding of this section may change depending on chosen implementation
+ // Test optional attribute, with a value
+ OptionalAttributeElement optionalAttributeInput;
+ optionalAttributeInput.setoptionalAttribute(-123456789);
+ OptionalAttributeElement* optionalAttributeResult = asOptionalAttribute(&optionalAttributeInput);
+ if (optionalAttributeResult->getoptionalAttribute())
+ printf( "optional attribute, with data=" , optionalAttributeResult->getoptionalAttribute() );
+ else
+ printf( "optional attribute, with data=<not present>\n" );
+ delete optionalAttributeResult;
+
+ // Test optional attribute, not present
+ optionalAttributeInput.setattribute();
+ optionalAttributeResult = asOptionalAttribute(&optionalAttributeInput);
+ if (optionalAttributeResult->getoptionalAttribute())
+ printf( "optional attribute, not present=" , optionalAttributeResult->getoptionalAttribute() );
+ else
+ printf( "optional attribute, not present=<not present>\n" );
+ delete optionalAttributeResult;
+*/
+
+ // Test array
+ {
+#define ARRAY_SIZE 2
+ int i, outputSize=0;
+
+ xsdc__negativeInteger_Array arrayInput;
+ xsdc__negativeInteger_Array* arrayResult;
+ const xsdc__negativeInteger ** output;
+ xsdc__negativeInteger * array[ARRAY_SIZE];
+
+ input = -123456789;
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ array[i] = &input;
+
+ arrayInput.m_Array = array;
+ arrayInput.m_Size = ARRAY_SIZE;
+ arrayInput.m_Type = XSDC_NEGATIVEINTEGER;
+
+ arrayResult = asArray(ws, &arrayInput);
+
+ if (arrayResult)
+ {
+ output = arrayResult->m_Array;
+ outputSize = arrayResult->m_Size;
+ }
+
+ printf("array of %d elements\n" , outputSize );
+ for (i = 0; i < outputSize; i++)
+ printf( " element[%d]=%lld\n" , i, *((xsdc__negativeInteger*)(output[i])) );
+
+ axiscAxisDelete(arrayResult, XSDC_ARRAY);
+ }
+
+
+ // Test complex type
+ {
+ SimpleComplexType complexTypeInput;
+ SimpleComplexType* complexTypeResult;
+
+ complexTypeInput.complexTypeElement = -123456789;
+ complexTypeResult = asComplexType(ws, &complexTypeInput);
+ printf( "within complex type=%lld\n" , complexTypeResult->complexTypeElement );
+ Axis_Delete_SimpleComplexType(complexTypeResult, 0);
+ }
+
+ // Tests now complete
+ destroy_XSD_negativeInteger_stub(ws);
+
+ printf("---------------------- TEST COMPLETE -----------------------------\n");
+
+ return 0;
+}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_NCNameClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_NCNameClient.cpp?rev=405301&r1=405300&r2=405301&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_NCNameClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_NCNameClient.cpp Mon May 8 21:30:54 2006
@@ -234,36 +234,42 @@
*/
// Test array
- int arraySize=2;
+#define ARRAY_SIZE 2
+ int i, outputSize=0;
+
xsd__NCName_Array arrayInput;
- xsd__NCName * array=new xsd__NCName[arraySize];
- for (int inputIndex=0 ; inputIndex < 2 ; inputIndex++)
+ xsd__NCName_Array* arrayResult;
+ xsd__NCName array[ARRAY_SIZE];
+ const xsd__NCName* output;
+
+ for (i=0 ; i < 2 ; i++)
{
- array[inputIndex]= new char[25];
- strcpy (array[inputIndex], simpleNCName);
+ array[i]= new char[25];
+ strcpy (array[i], simpleNCName);
}
- arrayInput.set(array,arraySize);
- xsd__NCName_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize = 0;
- const xsd__NCName* output = arrayResult->get(outputSize);
+ 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];
+ for (i = 0 ; i < ARRAY_SIZE ; i++ )
+ delete array[i];
- delete [] array;
delete arrayResult;
// Test complex type
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_negativeIntegerClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_negativeIntegerClient.cpp?rev=405301&r1=405300&r2=405301&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_negativeIntegerClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_negativeIntegerClient.cpp Mon May 8 21:30:54 2006
@@ -22,22 +22,29 @@
int main(int argc, char* argv[])
{
+ XSD_negativeInteger* ws;
+
+ xsd__negativeInteger result;
+ xsd__negativeInteger input;
+ xsd__negativeInteger* nillableResult;
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_negativeInteger";
if(argc>1)
url = argv[1];
- // bool bSuccess = false;
-
try
{
sprintf(endpoint, "%s", url);
- XSD_negativeInteger* ws = new XSD_negativeInteger(endpoint);
- xsd__negativeInteger result = ws->asNonNillableElement((xsd__negativeInteger) LONGLONGVALUE(-9223372036854775808));
+ ws = new XSD_negativeInteger(endpoint);
+
+ result = ws->asNonNillableElement((xsd__negativeInteger) LONGLONGVALUE(-9223372036854775808));
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__negativeInteger)-1);
cout << "non-nillable element=" << result << endl;
+
try
{
result = ws->asNonNillableElement((xsd__negativeInteger)0);
@@ -54,21 +61,16 @@
result = ws->asNonNillableElement((xsd__negativeInteger)-123456789);
cout << "non-nillable element=" << result << endl;
-
// Test nillable element, with a value
- xsd__negativeInteger* nillableInput = new xsd__negativeInteger();
- *(nillableInput) = (xsd__negativeInteger)-123456789;
- xsd__negativeInteger* nillableResult = ws->asNillableElement(nillableInput);
+ input = (xsd__negativeInteger)-123456789;
+ nillableResult = ws->asNillableElement(&input);
if (nillableResult)
{
cout << "nillable element=" << *(nillableResult) << endl;
delete nillableResult;
}
else
- {
cout << "nillable element=<nil>" << endl;
- }
- delete nillableInput;
// Test nillable element, with nil
nillableResult = ws->asNillableElement(NULL);
@@ -78,9 +80,7 @@
delete nillableResult;
}
else
- {
cout << "nil element=<nil>" << endl;
- }
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
@@ -96,55 +96,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__negativeInteger_Array arrayInput;
- int arraySize=2;
- xsd__negativeInteger ** array = new xsd__negativeInteger*[arraySize];
+ xsd__negativeInteger_Array* arrayResult;
+ const xsd__negativeInteger ** output;
+ xsd__negativeInteger * array[ARRAY_SIZE];
- for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
- {
- array[inputIndex] = new xsd__negativeInteger(-123456789);
-
- }
- arrayInput.set(array,arraySize);
- xsd__negativeInteger_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize=0;
- const xsd__negativeInteger ** output = arrayResult->get(outputSize);
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ array[i] = new xsd__negativeInteger(-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__negativeInteger*)(output[index])) << endl;
-
- }
+ for (i = 0; i < outputSize; i++)
+ cout << " element[" << i << "]=" << *((xsd__negativeInteger*)(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;
Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_negativeIntegerC.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_negativeIntegerC.xml?rev=405301&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_negativeIntegerC.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_negativeIntegerC.xml Mon May 8 21:30:54 2006
@@ -0,0 +1,17 @@
+<test>
+ <name>XSD_negativeIntegerC</name>
+ <description>Test serialization and deserialization of the XSD built-in simple type negativeInteger</description>
+ <clientLang>c</clientLang>
+ <clientCode>XSD_negativeIntegerClient.c</clientCode>
+ <wsdl>XSD_negativeInteger.wsdl</wsdl>
+ <expected>
+ <output>
+ XSD_negativeInteger.expected
+ </output>
+ <serverResponse>
+ XSD_negativeInteger_ServerResponse.expected
+ </serverResponse>
+ </expected>
+ <endpoint>http://localhost:80/axis/XSD_negativeInteger</endpoint>
+</test>
+