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 18:33:20 UTC
svn commit: r405461 - in
/webservices/axis/trunk/c/tests/auto_build/testcases: client/c/ client/cpp/
tests/
Author: nadiramra
Date: Tue May 9 09:33:17 2006
New Revision: 405461
URL: http://svn.apache.org/viewcvs?rev=405461&view=rev
Log:
C support fixes/enhancements. Testcases for C bindings.
Added:
webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_intClient.c
webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_integerClient.c
webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_languageClient.c
webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_longClient.c
webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_intC.xml
webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_integerC.xml
webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_languageC.xml
webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_longC.xml
Modified:
webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_IDClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_intClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_integerClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_languageClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_longClient.cpp
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c?rev=405461&r1=405460&r2=405461&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c Tue May 9 09:33:17 2006
@@ -301,6 +301,7 @@
{
#define ARRAY_SIZE 2
int i, outputSize=0;
+
xsdc__ID_Array arrayInput;
xsdc__ID_Array* arrayResult;
xsdc__ID array[ARRAY_SIZE];
@@ -316,9 +317,6 @@
arrayInput.m_Type = XSDC_ID;
arrayResult = asArray(ws, &arrayInput);
- if (exceptionOccurred == C_TRUE
- || get_XSD_IDPort_Status(ws) == AXISC_FAIL )
- printf ("Failed\n");
if (arrayResult)
{
Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_intClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_intClient.c?rev=405461&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_intClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_intClient.c Tue May 9 09:33:17 2006
@@ -0,0 +1,162 @@
+// 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_int.h"
+
+
+int main(int argc, char* argv[])
+{
+ AXISCHANDLE ws;
+
+ xsdc__int input;
+ xsdc__int result;
+ xsdc__int* nillableResult;
+
+ char endpoint[256];
+ const char* url="http://localhost:80/axis/XSD_int";
+
+ if(argc>1)
+ url = argv[1];
+
+ sprintf(endpoint, "%s", url);
+ ws = get_XSD_int_stub(endpoint);
+
+ result = asNonNillableElement(ws, (xsdc__int)2147483647);
+ printf( "non-nillable element=%d\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__int)1);
+ printf( "non-nillable element=%d\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__int)-2147483648);
+ printf( "non-nillable element=%d\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__int)-1);
+ printf( "non-nillable element=%d\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__int)0);
+ printf( "non-nillable element=%d\n" , result );
+
+
+ // Test nillable element, with a value
+ input = (xsdc__int)123456789;
+ nillableResult = asNillableElement(ws, &input);
+ if (nillableResult)
+ {
+ printf( "nillable element=%d\n" , *(nillableResult) );
+ axiscAxisDelete(nillableResult, XSDC_INT);
+ }
+ else
+ printf( "nillable element=<nil>\n" );
+
+ // Test nillable element, with nil
+ nillableResult = asNillableElement(ws, NULL);
+ if (nillableResult)
+ {
+ printf( "nil element=%d\n" , *(nillableResult) );
+ axiscAxisDelete(nillableResult, XSDC_INT);
+ }
+ else
+ printf( "nil element=<nil>\n" );
+
+ // Test required attribute
+ {
+ RequiredAttributeElement requiredAttributeInput;
+ RequiredAttributeElement* requiredAttributeResult;
+
+ requiredAttributeInput.requiredAttribute =123456789;
+ requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+ printf( "required attribute=%d\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__int_Array arrayInput;
+ xsdc__int_Array* arrayResult;
+ xsdc__int ** output;
+ xsdc__int * array[ARRAY_SIZE];
+
+ input = 123456789;
+ for (i=0 ; i < 2 ; i++)
+ array[i] = &input;
+
+ arrayInput.m_Array = array;
+ arrayInput.m_Size = ARRAY_SIZE;
+ arrayInput.m_Type = XSDC_INT;
+
+ 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]=%d\n", i , *((xsdc__int*)(output[i])) );
+
+ axiscAxisDelete(arrayResult, XSDC_ARRAY);
+ }
+
+ // Test complex type
+ {
+ SimpleComplexType complexTypeInput;
+ SimpleComplexType* complexTypeResult;
+
+ complexTypeInput.complexTypeElement = 123456789;
+ complexTypeResult = asComplexType(ws, &complexTypeInput);
+ printf( "within complex type=%d\n" , complexTypeResult->complexTypeElement );
+ Axis_Delete_SimpleComplexType(complexTypeResult, 0);
+ }
+
+ // Tests now complete
+ destroy_XSD_int_stub(ws);
+
+
+ printf("---------------------- TEST COMPLETE -----------------------------\n");
+
+ return 0;
+}
Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_integerClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_integerClient.c?rev=405461&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_integerClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_integerClient.c Tue May 9 09:33:17 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_integer.h"
+
+int main(int argc, char* argv[])
+{
+ AXISCHANDLE ws;
+
+ xsdc__integer result;
+ xsdc__integer input;
+ xsdc__integer* nillableResult;
+
+ char endpoint[256];
+ const char* url="http://localhost:80/axis/XSD_integer";
+
+ if(argc>1)
+ url = argv[1];
+
+ sprintf(endpoint, "%s", url);
+ ws = get_XSD_integer_stub(endpoint);
+
+ result = asNonNillableElement(ws, (xsdc__integer) LONGLONGVALUE(9223372036854775807));
+ printf( "non-nillable element=%lld\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__integer)1);
+ printf( "non-nillable element=%lld\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__integer) LONGLONGVALUE(-9223372036854775808));
+ printf( "non-nillable element=%lld\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__integer)-1);
+ printf( "non-nillable element=%lld\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__integer)0);
+ printf( "non-nillable element=%lld\n" , result );
+
+
+ // Test nillable element, with a value
+ input = (xsdc__integer)123456789;
+ nillableResult = asNillableElement(ws, &input);
+ if (nillableResult)
+ {
+ printf( "nillable element=%lld\n" , *(nillableResult) );
+ axiscAxisDelete(nillableResult, XSDC_INTEGER);
+ }
+ 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_INTEGER);
+ }
+ 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 arrays
+ {
+#define ARRAY_SIZE 2
+ int i, outputSize=0;
+
+ xsdc__integer_Array arrayInput;
+ xsdc__integer_Array * arrayResult;
+ xsdc__integer* array[ARRAY_SIZE];
+ xsdc__integer** output;
+
+ 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_INTEGER;
+
+ 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]=", i);
+ if (output[i])
+ printf("%lld\n", *output[i] );
+ else
+ printf( "NULL\n" );
+ }
+
+
+ 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_integer_stub(ws);
+
+ printf("---------------------- TEST COMPLETE -----------------------------\n");
+
+ return 0;
+}
Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_languageClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_languageClient.c?rev=405461&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_languageClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_languageClient.c Tue May 9 09:33:17 2006
@@ -0,0 +1,285 @@
+// 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_language.h"
+
+
+int main(int argc, char* argv[])
+{
+ AXISCHANDLE ws;
+
+ xsdc__language input;
+ xsdc__language result;
+
+ RequiredAttributeElement requiredAttributeInput;
+ RequiredAttributeElement* requiredAttributeResult;
+
+ char emptylanguage[1] = "";
+ char simplelanguage[25] = "A simple test message!";
+ char reservedCharacterslanguage[] = "<>&\"\'";
+ char whitespacelanguage[] = " \t\r\nsome text \t\r\nmore text \t\r\n";
+
+ char endpoint[256];
+ const char* url="http://localhost:80/axis/XSD_language";
+
+ if(argc>1)
+ url = argv[1];
+
+ sprintf(endpoint, "%s", url);
+ ws = get_XSD_language_stub(endpoint);
+
+ // Test non-nillable element
+ input = simplelanguage;
+ result = asNonNillableElement(ws, input);
+ if (result)
+ {
+ if (*result)
+ printf( "non-nillable element=%s\n" , result );
+ else
+ printf( "non-nillable element=<empty>\n" );
+ axiscAxisDelete(result, XSDC_LANGUAGE);
+ }
+ else
+ printf( "non-nillable element=<nil>\n" );
+
+ // Test empty non-nillable element
+ input = emptylanguage;
+ result = asNonNillableElement(ws, input);
+ if (result)
+ {
+ if (*result)
+ printf( "empty non-nillable element=%s\n" , result );
+ else
+ printf( "empty non-nillable element=<empty>\n" );
+ axiscAxisDelete(result, XSDC_LANGUAGE);
+ }
+ else
+ printf( "empty non-nillable element=<nil>\n" );
+
+ // Test non-nillable element with XML reserved characters
+ result = asNonNillableElement(ws, reservedCharacterslanguage);
+ if (result)
+ {
+ if (*result)
+ printf( "non-nillable element with XML reserved characters=%s\n" , result );
+ else
+ printf( "non-nillable element with XML reserved characters=<empty>\n" );
+ axiscAxisDelete(result, XSDC_LANGUAGE);
+ }
+ else
+ printf( "non-nillable element with XML reserved characters=<nil>\n" );
+
+ // Test non-nillable element with XML reserved characters
+ result = asNonNillableElement(ws, whitespacelanguage);
+ if (result)
+ {
+ if (*result)
+ printf( "non-nillable element with whitespace characters=\"%s\"\n" , result);
+ else
+ printf( "non-nillable element with whitespace characters=<empty>\n" );
+ axiscAxisDelete(result, XSDC_LANGUAGE);
+ }
+ else
+ printf( "non-nillable element with whitespace characters=<nil>\n" );
+
+ // Test nillable element, with a value
+ input = simplelanguage;
+ result = asNillableElement(ws, input);
+ if (result)
+ {
+ if (*result)
+ printf( "nillable element=%s\n" , result );
+ else
+ printf( "nillable element=<empty>\n" );
+ axiscAxisDelete(result, XSDC_LANGUAGE);
+ }
+ else
+ printf( "nillable element=<nil>\n" );
+
+ // Test empty nillable element
+ result = asNillableElement(ws, emptylanguage);
+ if (result)
+ {
+ if (*result)
+ printf( "empty nillable element=%s\n" , result );
+ else
+ printf( "empty nillable element=<empty>\n" );
+ axiscAxisDelete(result, XSDC_LANGUAGE);
+ }
+ else
+ printf( "empty nillable element=<nil>\n" );
+
+ // Test nillable element, with nil
+ result = asNillableElement(ws, NULL);
+ if (result)
+ {
+ if (*result)
+ printf( "nil element=%s\n" , result );
+ else
+ printf( "nil element=<empty>\n" );
+ axiscAxisDelete(result, XSDC_LANGUAGE);
+ }
+ else
+ printf( "nil element=<nil>\n" );
+
+ // Test required attribute
+ requiredAttributeInput.requiredAttribute = simplelanguage;
+ requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+ if (requiredAttributeResult->requiredAttribute)
+ {
+ if (*(requiredAttributeResult->requiredAttribute))
+ printf( "required attribute=%s\n" , requiredAttributeResult->requiredAttribute );
+ else
+ printf( "required attribute=<empty>\n" );
+ }
+ else
+ printf( "required attribute=<nil>\n" );
+ Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
+
+ // Test empty required attribute
+ requiredAttributeInput.requiredAttribute = emptylanguage;
+ requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+ if (requiredAttributeResult->requiredAttribute)
+ {
+ if (*(requiredAttributeResult->requiredAttribute))
+ printf( "empty required attribute=%s\n" , requiredAttributeResult->requiredAttribute );
+ else
+ printf( "empty required attribute=<empty>\n" );
+ }
+ else
+ printf( "empty required attribute=<nil>\n" );
+ 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
+ input = new char[25];
+ strcpy (input, simplelanguage);
+ OptionalAttributeElement optionalAttributeInput;
+ optionalAttributeInput.setoptionalAttribute(input);
+ OptionalAttributeElement* optionalAttributeResult = asOptionalAttribute(&optionalAttributeInput);
+ if (optionalAttributeResult->getoptionalAttribute())
+ {
+ if (*(optionalAttributeResult->getoptionalAttribute()))
+ {
+ printf( "optional attribute, with data=" , optionalAttributeResult->getoptionalAttribute() );
+ }
+ else
+ {
+ printf( "optional attribute, with data=<empty>\n" );
+ }
+ }
+ else
+ {
+ printf( "optional attribute, with data=<not present>\n" );
+ }
+ delete [] input;
+ delete optionalAttributeResult;
+
+ // Test empty optional attribute
+ emptyInput = new char[1];
+ strcpy (emptyInput, emptylanguage);
+ optionalAttributeInput.setoptionalAttribute(emptyInput);
+ optionalAttributeResult = asOptionalAttribute(&optionalAttributeInput);
+ if (optionalAttributeResult->getoptionalAttribute())
+ {
+ if (*(optionalAttributeResult->getoptionalAttribute()))
+ printf( "empty optional attribute=" , optionalAttributeResult->getoptionalAttribute() );
+ else
+ printf( "empty optional attribute=<empty>\n" );
+ }
+ else
+ printf( "empty optional attribute=<not present>\n" );
+ delete [] emptyInput;
+ delete optionalAttributeResult;
+
+ // Test optional attribute, not present
+ // optionalAttributeInput.setattribute();
+ optionalAttributeResult = asOptionalAttribute(&optionalAttributeInput);
+ if (optionalAttributeResult->getoptionalAttribute())
+ {
+ if (*(optionalAttributeResult->getoptionalAttribute()))
+ printf( "optional attribute, not present=" , optionalAttributeResult->getoptionalAttribute() );
+ else
+ printf( "optional attribute, not present=<empty>\n" );
+ }
+ else
+ printf( "optional attribute, not present=<not present>\n" );
+ delete optionalAttributeResult;
+*/
+
+ // Test array
+ {
+#define ARRAY_SIZE 2
+ int i, outputSize=0;
+
+ xsdc__language_Array arrayInput;
+ xsdc__language_Array* arrayResult;
+ xsdc__language array[ARRAY_SIZE];
+ xsdc__language *output;
+
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ array[i] = simplelanguage;
+
+ arrayInput.m_Array = array;
+ arrayInput.m_Size = ARRAY_SIZE;
+ arrayInput.m_Type = XSDC_LANGUAGE;
+
+ 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]=%s\n", i , output[i] ? output[i] : "<empty>" );
+
+ axiscAxisDelete(arrayResult, XSDC_ARRAY);
+ }
+
+ // Test complex type
+ {
+ SimpleComplexType complexTypeInput;
+ SimpleComplexType* complexTypeResult;
+
+ complexTypeInput.complexTypeElement = simplelanguage;
+ complexTypeResult = asComplexType(ws, &complexTypeInput);
+ if (complexTypeResult->complexTypeElement)
+ {
+ if (*(complexTypeResult->complexTypeElement))
+ printf( "within complex type=%s\n" , complexTypeResult->complexTypeElement );
+ else
+ printf( "within complex type=<empty>\n" );
+ }
+ else
+ printf( "within complex type=<nil>\n" );
+ Axis_Delete_SimpleComplexType(complexTypeResult, 0);
+ }
+
+ // Tests now complete
+
+ destroy_XSD_language_stub(ws);
+
+ printf("---------------------- TEST COMPLETE -----------------------------\n");
+
+ return 0;
+}
Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_longClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_longClient.c?rev=405461&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_longClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_longClient.c Tue May 9 09:33:17 2006
@@ -0,0 +1,161 @@
+// 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_long.h"
+
+int main(int argc, char* argv[])
+{
+ AXISCHANDLE ws;
+
+ xsdc__long result;
+ xsdc__long input;
+ xsdc__long* nillableResult;
+
+ char endpoint[256];
+ const char* url="http://localhost:80/axis/XSD_long";
+
+ if(argc>1)
+ url = argv[1];
+
+
+ sprintf(endpoint, "%s", url);
+ ws = get_XSD_long_stub(endpoint);
+
+ result = asNonNillableElement(ws, (xsdc__long) LONGLONGVALUE(9223372036854775807));
+ printf( "non-nillable element=%lld\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__long)1);
+ printf( "non-nillable element=%lld\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__long) LONGLONGVALUE(-9223372036854775808));
+ printf( "non-nillable element=%lld\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__long)-1);
+ printf( "non-nillable element=%lld\n" , result );
+
+ result = asNonNillableElement(ws, (xsdc__long)0);
+ printf( "non-nillable element=%lld\n" , result );
+
+
+ // Test nillable element, with a value
+ input = (xsdc__long)123456789;
+ nillableResult = asNillableElement(ws, &input);
+ if (nillableResult)
+ {
+ printf( "nillable element=%lld\n" , *(nillableResult) );
+ axiscAxisDelete(nillableResult, XSDC_LONG);
+ }
+ 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_LONG);
+ }
+ 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__long_Array arrayInput;
+ xsdc__long_Array* arrayResult;
+ xsdc__long * array[ARRAY_SIZE];
+ xsdc__long ** output;
+
+ 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_LONG;
+
+ 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__long*)(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_long_stub(ws);
+
+ printf("---------------------- TEST COMPLETE -----------------------------\n");
+
+ return 0;
+}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_IDClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_IDClient.cpp?rev=405461&r1=405460&r2=405461&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_IDClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_IDClient.cpp Tue May 9 09:33:17 2006
@@ -259,35 +259,35 @@
// Test array
- int arraySize = 2;
+ int ARRAY_SIZE = 2;
xsd__ID_Array arrayInput;
- xsd__ID * array=new xsd__ID[arraySize];
- for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
+ xsd__ID * array=new xsd__ID[ARRAY_SIZE];
+ for (int i=0 ; i < ARRAY_SIZE ; i++)
{
- array[inputIndex]= new char[25];
- strcpy (array[inputIndex], simpleID);
+ array[i]= new char[25];
+ strcpy (array[i], simpleID);
}
- arrayInput.set(array,arraySize);
+ arrayInput.set(array,ARRAY_SIZE);
xsd__ID_Array* arrayResult = ws->asArray(&arrayInput);
int outputSize=0;
const xsd__ID * output=arrayResult->get(outputSize);
cout << "array of " << outputSize << " elements" << endl;
- for (int index = 0; index < outputSize ; index++)
+ for (int 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 (int i = 0 ; i < ARRAY_SIZE ; i++ )
+ delete array[i];
delete [] array;
delete arrayResult;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_intClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_intClient.cpp?rev=405461&r1=405460&r2=405461&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_intClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_intClient.cpp Tue May 9 09:33:17 2006
@@ -13,6 +13,14 @@
// 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_int.hpp"
#include <axis/AxisException.hpp>
@@ -21,14 +29,18 @@
int main(int argc, char* argv[])
{
+ XSD_int* ws;
+
+ xsd__int input;
+ xsd__int result;
+ xsd__int* nillableResult;
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_int";
if(argc>1)
url = argv[1];
- // bool bSuccess = false;
-
try
{
sprintf(endpoint, "%s", url);
@@ -36,30 +48,30 @@
xsd__int result = ws->asNonNillableElement((xsd__int)2147483647);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__int)1);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__int)-2147483648);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__int)-1);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__int)0);
cout << "non-nillable element=" << result << endl;
// Test nillable element, with a value
- xsd__int* nillableInput = new xsd__int();
- *(nillableInput) = (xsd__int)123456789;
- xsd__int* nillableResult = ws->asNillableElement(nillableInput);
+ input = (xsd__int)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);
@@ -69,14 +81,14 @@
delete nillableResult;
}
else
- {
cout << "nil element=<nil>" << endl;
- }
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
+ RequiredAttributeElement* requiredAttributeResult;
+
requiredAttributeInput.setrequiredAttribute(123456789);
- RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
+ requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
cout << "required attribute=" << requiredAttributeResult->getrequiredAttribute() << endl;
delete requiredAttributeResult;
@@ -87,61 +99,53 @@
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__int_Array arrayInput;
- int arraySize=2;
- xsd__int ** array = new xsd__int*[arraySize];
+ xsd__int_Array* arrayResult;
+ const xsd__int ** output;
+ xsd__int * array[ARRAY_SIZE];
- for (int inputIndex=0 ; inputIndex < 2 ; inputIndex++)
- {
- array[inputIndex] = new xsd__int(123456789);
-
- }
- arrayInput.set(array,arraySize);
- xsd__int_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize=0;
- const xsd__int ** output = arrayResult->get(outputSize);
+ for (i=0 ; i < 2 ; i++)
+ array[i] = new xsd__int(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__int*)(output[index])) << endl;
-
- }
+ for (i = 0; i < outputSize ; i++)
+ cout << " element[" << i << "]=" << *((xsd__int*)(output[i])) << endl;
// Clear up input array
- for (int deleteIndex = 0 ; deleteIndex < arraySize ; deleteIndex++ )
+ for (i = 0 ; i < ARRAY_SIZE ; i++ )
{
- delete array[deleteIndex];
+ delete array[i];
}
- delete [] array;
delete arrayResult;
// Test complex type
SimpleComplexType complexTypeInput;
+ SimpleComplexType* complexTypeResult;
+
complexTypeInput.setcomplexTypeElement(123456789);
- SimpleComplexType* complexTypeResult = ws->asComplexType(&complexTypeInput);
+ complexTypeResult = ws->asComplexType(&complexTypeInput);
cout << "within complex type=" << complexTypeResult->getcomplexTypeElement() << endl;
delete complexTypeResult;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_integerClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_integerClient.cpp?rev=405461&r1=405460&r2=405461&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_integerClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_integerClient.cpp Tue May 9 09:33:17 2006
@@ -13,6 +13,14 @@
// 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_integer.hpp"
#include <axis/AxisException.hpp>
@@ -22,6 +30,12 @@
int main(int argc, char* argv[])
{
+ XSD_integer* ws;
+
+ xsd__integer result;
+ xsd__integer input;
+ xsd__integer* nillableResult;
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_integer";
@@ -33,33 +47,34 @@
try
{
sprintf(endpoint, "%s", url);
- XSD_integer* ws = new XSD_integer(endpoint);
- xsd__integer result = ws->asNonNillableElement((xsd__integer) LONGLONGVALUE(9223372036854775807));
+ ws = new XSD_integer(endpoint);
+
+ result = ws->asNonNillableElement((xsd__integer) LONGLONGVALUE(9223372036854775807));
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__integer)1);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__integer) LONGLONGVALUE(-9223372036854775808));
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__integer)-1);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__integer)0);
cout << "non-nillable element=" << result << endl;
// Test nillable element, with a value
- xsd__integer* nillableInput = new xsd__integer();
- *(nillableInput) = (xsd__integer)123456789;
- xsd__integer* nillableResult = ws->asNillableElement(nillableInput);
+ input = (xsd__integer)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);
@@ -69,14 +84,14 @@
delete nillableResult;
}
else
- {
cout << "nil element=<nil>" << endl;
- }
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
+ RequiredAttributeElement* requiredAttributeResult;
+
requiredAttributeInput.setrequiredAttribute(123456789);
- RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
+ requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
cout << "required attribute=" << requiredAttributeResult->getrequiredAttribute() << endl;
delete requiredAttributeResult;
@@ -87,74 +102,65 @@
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 arrays
- int arraySize = 2;
+#define ARRAY_SIZE 2
+ int i, outputSize=0;
+
xsd__integer_Array inputArray;
- xsd__integer** array = new xsd__integer*[arraySize];
- for (int count = 0 ; count < arraySize ; count++)
- {
- array[count] = new xsd__integer(123456789);
- }
- inputArray.set(array, arraySize);
+ xsd__integer_Array * arrayResult;
+ xsd__integer* array[ARRAY_SIZE];
+ const xsd__integer** output;
+
+ for (i = 0 ; i < ARRAY_SIZE ; i++)
+ array[i] = new xsd__integer(123456789);
+ inputArray.set(array, ARRAY_SIZE);
- xsd__integer_Array * arrayResult = ws->asArray(&inputArray);
- int outputSize = 0;
- const xsd__integer** output = arrayResult->get(outputSize);
+ arrayResult = ws->asArray(&inputArray);
+
+ if (arrayResult)
+ 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
SimpleComplexType complexTypeInput;
+ SimpleComplexType* complexTypeResult;
+
complexTypeInput.setcomplexTypeElement(123456789);
- SimpleComplexType* complexTypeResult = ws->asComplexType(&complexTypeInput);
+ complexTypeResult = ws->asComplexType(&complexTypeInput);
cout << "within complex type=" << complexTypeResult->getcomplexTypeElement() << endl;
delete complexTypeResult;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_languageClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_languageClient.cpp?rev=405461&r1=405460&r2=405461&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_languageClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_languageClient.cpp Tue May 9 09:33:17 2006
@@ -13,6 +13,14 @@
// 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_language.hpp"
#include <axis/AxisException.hpp>
@@ -22,6 +30,19 @@
int main(int argc, char* argv[])
{
+ XSD_language* ws;
+
+ xsd__language input;
+ xsd__language result;
+
+ RequiredAttributeElement requiredAttributeInput;
+ RequiredAttributeElement* requiredAttributeResult;
+
+ char emptylanguage[1] = "";
+ char simplelanguage[25] = "A simple test message!";
+ char reservedCharacterslanguage[] = "<>&\"\'";
+ char whitespacelanguage[] = " \t\r\nsome text \t\r\nmore text \t\r\n";
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_language";
@@ -31,200 +52,126 @@
try
{
sprintf(endpoint, "%s", url);
- XSD_language* ws = new XSD_language(endpoint);
-
- char emptylanguage[1] = "";
- xsd__language emptyInput = new char[1];
- strcpy (emptyInput, emptylanguage);
- char simplelanguage[25] = "A simple test message!";
- xsd__language input = new char[25];
- strcpy (input, simplelanguage);
+ ws = new XSD_language(endpoint);
// Test non-nillable element
- xsd__language result = ws->asNonNillableElement(input);
+ input = simplelanguage;
+ 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 = emptylanguage;
+ 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;
- // Test non-nillable element with XML reserved characters
- char reservedCharacterslanguage[] = "<>&\"\'";
- xsd__language reservedCharactersInput = reservedCharacterslanguage;
- result = ws->asNonNillableElement(reservedCharactersInput);
+ // Test non-nillable element with XML reserved characters
+ result = ws->asNonNillableElement(reservedCharacterslanguage);
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;
- }
}
else
- {
cout << "non-nillable element with XML reserved characters=<nil>" << endl;
- }
// Test non-nillable element with XML reserved characters
- char whitespacelanguage[] = " \t\r\nsome text \t\r\nmore text \t\r\n";
- xsd__language whitespaceInput = whitespacelanguage;
- result = ws->asNonNillableElement(whitespaceInput);
+ result = ws->asNonNillableElement(whitespacelanguage);
if (result)
{
if (*result)
- {
cout << "non-nillable element with whitespace characters=\"" << result << "\"" << endl;
- }
else
- {
cout << "non-nillable element with whitespace characters=<empty>" << endl;
- }
}
else
- {
cout << "non-nillable element with whitespace characters=<nil>" << endl;
- }
// Test nillable element, with a value
- input = new char[25];
- strcpy (input, simplelanguage);
- xsd__language nillableResult = ws->asNillableElement(input);
- if (nillableResult)
+ input = simplelanguage;
+ 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, emptylanguage);
- nillableResult = ws->asNillableElement(emptyInput);
- if (nillableResult)
+ result = ws->asNillableElement(emptylanguage);
+ 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;
// 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];
- strcpy (input, simplelanguage);
- RequiredAttributeElement requiredAttributeInput;
- requiredAttributeInput.setrequiredAttribute(input);
- RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
+ requiredAttributeInput.setrequiredAttribute(simplelanguage);
+ requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
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, emptylanguage);
- requiredAttributeInput;
- requiredAttributeInput.setrequiredAttribute(emptyInput);
+ requiredAttributeInput.setrequiredAttribute(emptylanguage);
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
@@ -261,18 +208,12 @@
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 optionalAttributeResult;
@@ -282,84 +223,69 @@
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__language_Array arrayInput;
- int arraySize=2;
- xsd__language * array = new xsd__language[arraySize];
- for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
- {
- array[inputIndex] = new char[25];
- strcpy (array[inputIndex], simplelanguage);
+ xsd__language_Array* arrayResult;
+ xsd__language array[ARRAY_SIZE];
+ const xsd__language *output;
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ {
+ array[i] = new char[25];
+ strcpy (array[i], simplelanguage);
}
- arrayInput.set(array,arraySize);
- xsd__language_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize=0;
- const xsd__language *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];
- }
- delete [] array;
+ for (i = 0 ; i < ARRAY_SIZE ; i++ )
+ delete [] array[i];
delete arrayResult;
// Test complex type
- input = new char[25];
- strcpy (input, simplelanguage);
SimpleComplexType complexTypeInput;
- complexTypeInput.setcomplexTypeElement(input);
- SimpleComplexType* complexTypeResult = ws->asComplexType(&complexTypeInput);
+ SimpleComplexType* complexTypeResult;
+
+ complexTypeInput.setcomplexTypeElement(simplelanguage);
+ complexTypeResult = ws->asComplexType(&complexTypeInput);
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_longClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_longClient.cpp?rev=405461&r1=405460&r2=405461&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_longClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_longClient.cpp Tue May 9 09:33:17 2006
@@ -13,6 +13,14 @@
// 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_long.hpp"
#include <axis/AxisException.hpp>
@@ -22,6 +30,12 @@
int main(int argc, char* argv[])
{
+ XSD_long* ws;
+
+ xsd__long result;
+ xsd__long input;
+ xsd__long* nillableResult;
+
char endpoint[256];
const char* url="http://localhost:80/axis/XSD_long";
@@ -33,34 +47,34 @@
try
{
sprintf(endpoint, "%s", url);
- XSD_long* ws = new XSD_long(endpoint);
+ ws = new XSD_long(endpoint);
- xsd__long result = ws->asNonNillableElement((xsd__long) LONGLONGVALUE(9223372036854775807));
+ result = ws->asNonNillableElement((xsd__long) LONGLONGVALUE(9223372036854775807));
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__long)1);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__long) LONGLONGVALUE(-9223372036854775808));
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__long)-1);
cout << "non-nillable element=" << result << endl;
+
result = ws->asNonNillableElement((xsd__long)0);
cout << "non-nillable element=" << result << endl;
// Test nillable element, with a value
- xsd__long* nillableInput = new xsd__long();
- *(nillableInput) = (xsd__long)123456789;
- xsd__long* nillableResult = ws->asNillableElement(nillableInput);
+ input = (xsd__long)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);
@@ -70,14 +84,14 @@
delete nillableResult;
}
else
- {
cout << "nil element=<nil>" << endl;
- }
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
+ RequiredAttributeElement* requiredAttributeResult;
+
requiredAttributeInput.setrequiredAttribute(123456789);
- RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
+ requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
cout << "required attribute=" << requiredAttributeResult->getrequiredAttribute() << endl;
delete requiredAttributeResult;
@@ -88,62 +102,54 @@
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__long_Array arrayInput;
- int arraySize=2;
- xsd__long ** array = new xsd__long*[arraySize];
+ xsd__long_Array* arrayResult;
+ xsd__long * array[ARRAY_SIZE];
+ const xsd__long ** output;
- for (int inputIndex=0 ; inputIndex < arraySize ; inputIndex++)
- {
- array[inputIndex] = new xsd__long(123456789);
+ for (i=0 ; i < ARRAY_SIZE ; i++)
+ array[i] = new xsd__long(123456789);
+ arrayInput.set(array,ARRAY_SIZE);
+
+ arrayResult = ws->asArray(&arrayInput);
+ if (arrayResult)
+ output = arrayResult->get(outputSize);
- }
- arrayInput.set(array,arraySize);
- xsd__long_Array* arrayResult = ws->asArray(&arrayInput);
- int outputSize=0;
- const xsd__long ** output = arrayResult->get(outputSize);
cout << "array of " << outputSize << " elements" << endl;
- for (int index = 0; index < outputSize ; index++)
- {
- cout << " element[" << index << "]=" << *((xsd__long*)(output[index])) << endl;
-
- }
+ for (i = 0; i < outputSize ; i++)
+ cout << " element[" << i << "]=" << *((xsd__long*)(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;
+ SimpleComplexType* complexTypeResult;
+
complexTypeInput.setcomplexTypeElement(123456789);
- SimpleComplexType* complexTypeResult = ws->asComplexType(&complexTypeInput);
+ complexTypeResult = ws->asComplexType(&complexTypeInput);
cout << "within complex type=" << complexTypeResult->getcomplexTypeElement() << endl;
delete complexTypeResult;
Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_intC.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_intC.xml?rev=405461&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_intC.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_intC.xml Tue May 9 09:33:17 2006
@@ -0,0 +1,17 @@
+<test>
+ <name>XSD_intC</name>
+ <description>Test serialization and deserialization of the XSD built-in simple type int</description>
+ <clientLang>c</clientLang>
+ <clientCode>XSD_intClient.c</clientCode>
+ <wsdl>XSD_int.wsdl</wsdl>
+ <expected>
+ <output>
+ XSD_int.expected
+ </output>
+ <serverResponse>
+ XSD_int_ServerResponse.expected
+ </serverResponse>
+ </expected>
+ <endpoint>http://localhost:80/axis/XSD_int</endpoint>
+</test>
+
Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_integerC.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_integerC.xml?rev=405461&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_integerC.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_integerC.xml Tue May 9 09:33:17 2006
@@ -0,0 +1,17 @@
+<test>
+ <name>XSD_integerC</name>
+ <description>Test serialization and deserialization of the XSD built-in simple type integer</description>
+ <clientLang>c</clientLang>
+ <clientCode>XSD_integerClient.c</clientCode>
+ <wsdl>XSD_integer.wsdl</wsdl>
+ <expected>
+ <output>
+ XSD_integer.expected
+ </output>
+ <serverResponse>
+ XSD_integer_ServerResponse.expected
+ </serverResponse>
+ </expected>
+ <endpoint>http://localhost:80/axis/XSD_integer</endpoint>
+</test>
+
Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_languageC.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_languageC.xml?rev=405461&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_languageC.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_languageC.xml Tue May 9 09:33:17 2006
@@ -0,0 +1,17 @@
+<test>
+ <name>XSD_languageC</name>
+ <description>Test serialization and deserialization of the XSD built-in simple type language</description>
+ <clientLang>c</clientLang>
+ <clientCode>XSD_languageClient.c</clientCode>
+ <wsdl>XSD_language.wsdl</wsdl>
+ <expected>
+ <output>
+ XSD_language.expected
+ </output>
+ <serverResponse>
+ XSD_language_ServerResponse.expected
+ </serverResponse>
+ </expected>
+ <endpoint>http://localhost:80/axis/XSD_language</endpoint>
+</test>
+
Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_longC.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_longC.xml?rev=405461&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_longC.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_longC.xml Tue May 9 09:33:17 2006
@@ -0,0 +1,17 @@
+<test>
+ <name>XSD_longC</name>
+ <description>Test serialization and deserialization of the XSD built-in simple type long</description>
+ <clientLang>c</clientLang>
+ <clientCode>XSD_longClient.c</clientCode>
+ <wsdl>XSD_long.wsdl</wsdl>
+ <expected>
+ <output>
+ XSD_long.expected
+ </output>
+ <serverResponse>
+ XSD_long_ServerResponse.expected
+ </serverResponse>
+ </expected>
+ <endpoint>http://localhost:80/axis/XSD_long</endpoint>
+</test>
+