You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by na...@apache.org on 2006/05/16 03:15:44 UTC

svn commit: r406794 - in /webservices/axis/trunk/c: src/cbindings/ tests/auto_build/testcases/client/c/ tests/auto_build/testcases/tests/

Author: nadiramra
Date: Mon May 15 18:15:42 2006
New Revision: 406794

URL: http://svn.apache.org/viewcvs?rev=406794&view=rev
Log:
C support fixes/enhancements. Testcases for C bindings.

Added:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest1Client.c
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest2Client.c
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest3Client.c
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest4Client.c
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest1C.xml
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest2C.xml
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest3C.xml
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest4C.xml
Modified:
    webservices/axis/trunk/c/src/cbindings/IAttributeC.cpp

Modified: webservices/axis/trunk/c/src/cbindings/IAttributeC.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/cbindings/IAttributeC.cpp?rev=406794&r1=406793&r2=406794&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/cbindings/IAttributeC.cpp (original)
+++ webservices/axis/trunk/c/src/cbindings/IAttributeC.cpp Mon May 15 18:15:42 2006
@@ -70,7 +70,7 @@
 }
 
 AXISC_STORAGE_CLASS_INFO 
-int axiscAttributeSetUri(AXISCHANDLE attribute, 
+int axiscAttributeSetURI(AXISCHANDLE attribute, 
                           const AxiscChar * uri) 
 {
     IAttribute *attr = (IAttribute*)attribute;
@@ -158,7 +158,7 @@
 }
 
 AXISC_STORAGE_CLASS_INFO 
-const AxiscChar * axiscAttributeGetUri(AXISCHANDLE attribute) 
+const AxiscChar * axiscAttributeGetURI(AXISCHANDLE attribute) 
 {
     IAttribute *attr = (IAttribute*)attribute;
 

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest1Client.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest1Client.c?rev=406794&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest1Client.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest1Client.c Mon May 15 18:15:42 2006
@@ -0,0 +1,77 @@
+// 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.
+
+/* Tests setLocalName() and getLocalName()in IAttribute class 
+   @Author : James Jose
+*/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "CommonClientTestCode.h"
+#include "Calculator.h"
+
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;
+    
+    char endpoint[256];
+    const char* url="http://localhost:80/axis/Calculator";
+    const char* op = 0;
+    int i1=0, i2=0;
+    int iResult;
+    
+    const char *name="Name";
+    
+    AXISCHANDLE phb;
+    AXISCHANDLE attr, attr1;
+    AXISCHANDLE bn;
+    
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+
+    if (argc > 1)
+        url = argv[1];
+    sprintf(endpoint, "%s", url);
+    
+    ws = get_Calculator_stub(endpoint);
+    
+    phb = axiscStubCreateSOAPHeaderBlock(ws, "TestHeader","http://ws.apache.org/","ns");
+    attr=axiscHeaderBlockCreateAttribute(phb, "NAME","ns",NULL, "AXIS");
+    printf("%d\n", axiscAttributeSetLocalName(attr, NULL));
+    printf("%d\n",  axiscAttributeSetLocalName(attr, name));
+    bn=axiscHeaderBlockCreateImmediateChildBasicNode(phb, ELEMENT_NODE,"Project","","","");
+    attr1=axiscBasicNodeCreateAttribute(bn, "TYPE", NULL, NULL, "Open Source");
+    axiscAttributeSetLocalName(attr1, "Type");
+    printf( "Header Attribute Name = %s\n" , axiscAttributeGetLocalName(attr)) ;
+    printf( "Child Node Attribute Name = %s\n" , axiscAttributeGetLocalName(attr1) );
+    op = "add";
+    i1 = 2;
+    i2 = 3;
+    if (strcmp(op, "add") == 0)
+    {
+        iResult = add(ws, i1, i2);
+        printf("%d\n",  iResult );
+    }
+    
+    destroy_Calculator_stub(ws);
+    
+    printf("---------------------- TEST COMPLETE -----------------------------\n" );
+    
+    return 0;
+}
+

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest2Client.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest2Client.c?rev=406794&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest2Client.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest2Client.c Mon May 15 18:15:42 2006
@@ -0,0 +1,81 @@
+// 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.
+
+
+/* Tests setPrefix() and getPrefix()in IAttribute class
+@ Author : James Jose
+*/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "CommonClientTestCode.h"
+#include "Calculator.h"
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;
+    
+    char endpoint[256];
+    const char* url="http://localhost:80/axis/Calculator";
+    const char* op = 0;
+    int i1=0, i2=0;
+    int iResult;
+    
+    const char *prefix="nsp";
+    
+    AXISCHANDLE phb;
+    AXISCHANDLE attr1, attr2;
+    AXISCHANDLE bn;
+
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+    
+    if (argc > 1)
+        url = argv[1];
+    sprintf(endpoint, "%s", url);
+
+    ws = get_Calculator_stub(endpoint);
+    
+    phb = axiscStubCreateSOAPHeaderBlock(ws, "TestHeader","http://ws.apache.org/","nsp");
+    attr1=axiscHeaderBlockCreateAttribute(phb, "Name","ns", NULL, "AXIS");
+    
+    /* Tests for NULL Value */
+    printf("%d\n", axiscAttributeSetPrefix(attr1, NULL));
+    printf("%d\n", axiscAttributeSetPrefix(attr1, prefix));
+    bn=axiscHeaderBlockCreateImmediateChildBasicNode(phb, ELEMENT_NODE,"Project","","","");
+    attr2=axiscBasicNodeCreateAttribute(bn, "TYPE",NULL, NULL, "Open Source");
+    
+    /* Tests for non declared namespace prefix */
+    printf("%d\n", axiscAttributeSetPrefix(attr2, "nd"));
+    printf( "Header Attribute Prefix = %s\n" , axiscAttributeGetPrefix(attr1));
+    printf( "Child Node Attribute Prefix = %s\n" , axiscAttributeGetPrefix(attr2));
+    op = "add";
+    i1 = 2;
+    i2 = 3;
+    if (strcmp(op, "add") == 0)
+    {
+        iResult = add(ws, i1, i2);
+        printf("%d\n", iResult );
+    }
+    
+    destroy_Calculator_stub(ws);
+    
+    printf("---------------------- TEST COMPLETE -----------------------------\n");
+    
+    return 0;
+}
+

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest3Client.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest3Client.c?rev=406794&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest3Client.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest3Client.c Mon May 15 18:15:42 2006
@@ -0,0 +1,78 @@
+// 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.
+
+
+/* Tests setValue() and getValue()in IAttribute class
+@ Author : James Jose
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "CommonClientTestCode.h"
+#include "Calculator.h"
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;
+        
+    char endpoint[256];
+    const char* url="http://localhost:80/axis/Calculator";
+    const char* op = 0;
+    int i1=0, i2=0;
+    int iResult;
+    
+    const char *Value="AXIS";
+    
+    AXISCHANDLE phb;
+    AXISCHANDLE attr1, attr2;
+    AXISCHANDLE bn;
+
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+    
+    if (argc > 1)
+        url = argv[1];
+    sprintf(endpoint, "%s", url);
+
+    ws = get_Calculator_stub(endpoint);
+    
+    phb = axiscStubCreateSOAPHeaderBlock(ws, "TestHeader","http://ws.apache.org/","ns");
+    attr1=axiscHeaderBlockCreateAttribute(phb, "Name","ns", NULL, "axis");
+    
+    /*Tests for NULL Value */
+    printf("%d\n",  axiscAttributeSetValue(attr1, NULL) );
+    printf("%d\n",  axiscAttributeSetValue(attr1, Value));
+    
+    bn=axiscHeaderBlockCreateImmediateChildBasicNode(phb, ELEMENT_NODE,"Project","","","");
+    attr2=axiscBasicNodeCreateAttribute(bn, "TYPE", NULL, NULL, "OPEN SOURCE");
+    axiscAttributeSetValue(attr2, "Open Source");
+    printf( "Header Attribute Value = %s\n" , axiscAttributeGetValue(attr1));
+    printf( "Child Node Attribute Value = %s\n" , axiscAttributeGetValue(attr2));
+    op = "add";
+    i1 = 2;
+    i2 = 3;
+    if (strcmp(op, "add") == 0)
+    {
+        iResult = add(ws, i1, i2);
+        printf("%d\n",  iResult );
+    }
+    
+    destroy_Calculator_stub(ws);
+    
+    printf("---------------------- TEST COMPLETE -----------------------------\n");
+    return 0;
+}
+

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest4Client.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest4Client.c?rev=406794&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest4Client.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/IAttributeTest4Client.c Mon May 15 18:15:42 2006
@@ -0,0 +1,81 @@
+// 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.
+
+
+/* Tests setURI() and getURI()in IAttribute Class
+@ Author : James Jose
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "CommonClientTestCode.h"
+#include "Calculator.h"
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;
+    
+    char endpoint[256];
+    const char* url="http://localhost:80/axis/Calculator";
+    const char* op = 0;
+    int i1=0, i2=0;
+    int iResult;
+    const char *uri="http://axis.apache.com";
+
+    
+    AXISCHANDLE phb;
+    AXISCHANDLE nsp;
+    AXISCHANDLE attr1, *attr2;
+    AXISCHANDLE bn;
+
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+    
+    if (argc > 1)
+        url = argv[1];
+    sprintf(endpoint, "%s", url);
+
+    ws = get_Calculator_stub(endpoint);
+
+    phb = axiscStubCreateSOAPHeaderBlock(ws, "TestHeader","http://ws.apache.org/","ns");
+    nsp=axiscHeaderBlockCreateNamespaceDeclINamespace(phb, "nsp","http://apache.com");
+    attr1=axiscHeaderBlockCreateAttribute(phb, "Name","nsp", NULL,"axis");
+    printf("%d\n", axiscAttributeSetURI(attr1, NULL));
+
+    /* Changing the URI associated with the attribute. Here the prefix should also will change. */
+    printf("%d\n", axiscAttributeSetURI(attr1, "http://axis.apache.com"));
+    bn=axiscHeaderBlockCreateImmediateChildBasicNode(phb, ELEMENT_NODE,"Project","","","");
+    attr2=axiscBasicNodeCreateAttribute(bn, "TYPE", NULL, NULL, "OPEN SOURCE");
+    axiscAttributeSetURI(attr2, uri);
+    
+    printf( "Header Attribute Uri = %s\n" , axiscAttributeGetURI(attr1));
+    printf( "Child Node Attribute Uri = %s\n" , axiscAttributeGetURI(attr2));
+    op = "add";
+    i1 = 2;
+    i2 = 3;
+    if (strcmp(op, "add") == 0)
+    {
+        iResult = add(ws, i1, i2);
+        printf("%d\n", iResult );
+    }
+    
+    destroy_Calculator_stub(ws);
+    
+    printf("---------------------- TEST COMPLETE -----------------------------\n");
+    
+    return 0;
+}
+

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest1C.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest1C.xml?rev=406794&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest1C.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest1C.xml Mon May 15 18:15:42 2006
@@ -0,0 +1,16 @@
+<test>
+    <name>IAttributeTest1C</name>
+    <description>IAttributeTest1C</description>
+    <clientLang>c</clientLang>
+    <clientCode>IAttributeTest1Client.c</clientCode>
+    <wsdl>CalculatorDocC.wsdl</wsdl>
+    <expected>
+        <output>
+            IAttributeTest1.expected
+        </output>
+	<request> 
+		IAttributeTest1Request.out 
+	</request>
+    </expected>
+	<endpoint>http://localhost:80/axis/CalculatorDoc</endpoint>
+</test>

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest2C.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest2C.xml?rev=406794&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest2C.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest2C.xml Mon May 15 18:15:42 2006
@@ -0,0 +1,13 @@
+<test>
+    <name>IAttributeTest2C</name>
+    <description>IAttributeTest2C</description>
+    <clientLang>c</clientLang>
+    <clientCode>IAttributeTest2Client.c</clientCode>
+    <wsdl>CalculatorDocC.wsdl</wsdl>
+    <expected>
+        <output>
+            IAttributeTest2.expected
+        </output>
+    </expected>
+	<endpoint>http://localhost:80/axis/CalculatorDoc</endpoint>
+</test>

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest3C.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest3C.xml?rev=406794&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest3C.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest3C.xml Mon May 15 18:15:42 2006
@@ -0,0 +1,16 @@
+<test>
+    <name>IAttributeTest3C</name>
+    <description>IAttributeTest3C</description>
+    <clientLang>c</clientLang>
+    <clientCode>IAttributeTest3Client.c</clientCode>
+    <wsdl>CalculatorDocC.wsdl</wsdl>
+    <expected>
+        <output>
+            IAttributeTest3.expected
+        </output>
+	<request> 
+		IAttributeTest3Request.out 
+	</request>
+    </expected>
+	<endpoint>http://localhost:80/axis/CalculatorDoc</endpoint>
+</test>

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest4C.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest4C.xml?rev=406794&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest4C.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/IAttributeTest4C.xml Mon May 15 18:15:42 2006
@@ -0,0 +1,16 @@
+<test>
+    <name>IAttributeTest4C</name>
+    <description>IAttributeTest4C</description>
+    <clientLang>c</clientLang>
+    <clientCode>IAttributeTest4Client.c</clientCode>
+    <wsdl>CalculatorDocC.wsdl</wsdl>
+    <expected>
+        <output>
+            IAttributeTest4.expected
+        </output>
+	<request> 
+		IAttributeTest4Request.out 
+	</request>
+    </expected>
+	<endpoint>http://localhost:80/axis/CalculatorDoc</endpoint>
+</test>