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 da...@apache.org on 2006/06/06 13:34:34 UTC

svn commit: r412097 - in /webservices/axis2/trunk/c/woden/test: ./ Makefile.am main.c resources/ woden_test.c woden_test.h

Author: damitha
Date: Tue Jun  6 04:34:34 2006
New Revision: 412097

URL: http://svn.apache.org/viewvc?rev=412097&view=rev
Log:
Added a test folder for woden

Added:
    webservices/axis2/trunk/c/woden/test/
    webservices/axis2/trunk/c/woden/test/Makefile.am
    webservices/axis2/trunk/c/woden/test/main.c
    webservices/axis2/trunk/c/woden/test/resources/
    webservices/axis2/trunk/c/woden/test/woden_test.c
    webservices/axis2/trunk/c/woden/test/woden_test.h

Added: webservices/axis2/trunk/c/woden/test/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/woden/test/Makefile.am?rev=412097&view=auto
==============================================================================
--- webservices/axis2/trunk/c/woden/test/Makefile.am (added)
+++ webservices/axis2/trunk/c/woden/test/Makefile.am Tue Jun  6 04:34:34 2006
@@ -0,0 +1,29 @@
+TESTS = woden_test
+prgbindir=$(prefix)/bin/unit_test
+prglibdir=$(prefix)/lib/unit_test
+prglib_LTLIBRARIES = libtest_woden.la
+libtest_woden_la_SOURCES = \
+						   woden_test.c
+
+noinst_HEADERS= \
+				$(top_builddir)/test/*.h
+
+INCLUDES = -I$(top_builddir)/include \
+            -I${CUTEST_HOME}/include \
+			@AXIOMINC@ \
+			@UTILINC@ 
+
+prgbin_PROGRAMS = woden_test
+check_PROGRAMS = woden_test
+woden_test_SOURCES = main.c
+woden_test_LDADD   =  \
+					  libtest_woden.la  \
+					  ../src/wsdl20/libwoden_wsdl20.la
+                     -L$(CUTEST_HOME)/lib \
+                     -lcutest \
+                   	-laxis2_util \
+					-laxis2_axiom \
+					-laxis2_parser \
+                    $(GUTHTHILA_LIBS) \
+                    $(LIBXML2_LIBS)
+

Added: webservices/axis2/trunk/c/woden/test/main.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/woden/test/main.c?rev=412097&view=auto
==============================================================================
--- webservices/axis2/trunk/c/woden/test/main.c (added)
+++ webservices/axis2/trunk/c/woden/test/main.c Tue Jun  6 04:34:34 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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 "woden.h"
+
+void RunAllTests(
+        void) 
+{
+    CuString *output = CuStringNew();
+    CuSuite* suite = xml_schema_GetSuite();
+    CuSuiteRun(suite);
+    CuSuiteSummary(suite, output);
+    CuSuiteDetails(suite, output);
+    printf("%s", output->buffer);
+}
+
+int main(void) 
+{
+    RunAllTests();
+    getchar();
+    return 0;
+}
+

Added: webservices/axis2/trunk/c/woden/test/woden_test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/woden/test/woden_test.c?rev=412097&view=auto
==============================================================================
--- webservices/axis2/trunk/c/woden/test/woden_test.c (added)
+++ webservices/axis2/trunk/c/woden/test/woden_test.c Tue Jun  6 04:34:34 2006
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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 <CuTest.h>
+#include <stdio.h>
+#include <axis2_om.h>
+#include <axis2_env.h>
+#include "woden_test.h"
+
+
+static axis2_om_document_t* 
+get_root_element_from_filename(
+        const axis2_env_t *env, 
+        axis2_char_t *filename);
+
+void test_mixed_content(
+        CuTest *tc);
+
+CuSuite* xml_schema_GetSuite()
+{
+    CuSuite* suite = CuSuiteNew();
+    
+    SUITE_ADD_TEST(suite, test_mixed_content);
+
+    return suite;
+}
+
+void test_mixed_content(
+        CuTest *tc)
+{
+    axis2_env_t *env = NULL;
+    axis2_om_document_t *om_doc = NULL;
+    axis2_xml_schema_collection_t *sch_collection = NULL;
+    axis2_xml_schema_t *schema = NULL;
+    axis2_qname_t *qn = NULL;
+    void *ele = NULL;
+    void *cmp_type = NULL;
+    void *seq = NULL;
+    axis2_xml_schema_obj_collection_t *items = NULL;
+    void *sub_element = NULL;
+    axis2_qname_t *qn1 = NULL;
+    axis2_char_t *uri = NULL;
+    
+    
+    axis2_char_t *filename = "./resources/Calculator.wsdl"; 
+    
+    env = axis2_env_create_all("test.log", 1);
+    
+    om_doc = get_root_element_from_filename(env, filename);
+    
+    sch_collection = axis2_xml_schema_collection_create(env);
+    
+    schema = AXIS2_XML_SCHEMA_COLLECTION_READ_DOCUMENT(
+        sch_collection, env, om_doc);
+    
+    qn = axis2_qname_create(env, "unQualifiedLocals",
+            "http://unqualified-elements.example.com", NULL);
+    
+    ele = AXIS2_XML_SCHEMA_GET_ELEMENT_BY_QNAME(schema, env, qn);
+
+    CuAssertPtrNotNull(tc, ele);
+    
+    cmp_type = AXIS2_XML_SCHEMA_ELEMENT_GET_SCHEMA_TYPE(ele, env);
+    
+    CuAssertPtrNotNull(tc, cmp_type); 
+    
+    seq = AXIS2_XML_SCHEMA_COMPLEX_TYPE_GET_PARTICLE(cmp_type, env);
+    
+    CuAssertPtrNotNull(tc, seq);
+    
+    items = AXIS2_XML_SCHEMA_GROUP_BASE_GET_ITEMS(seq, env);
+    
+    CuAssertPtrNotNull(tc, items);
+    
+    sub_element = AXIS2_XML_SCHEMA_OBJ_COLLECTION_GET_ITEM(items, env, 0);
+    
+    CuAssertPtrNotNull(tc, sub_element);
+    
+    qn1 = AXIS2_XML_SCHEMA_ELEMENT_GET_QNAME(sub_element, env);
+    
+    CuAssertPtrNotNull(tc, qn1);
+    
+    uri = AXIS2_QNAME_GET_URI(qn1, env);
+    
+    CuAssertPtrNotNull(tc, uri);
+    
+    sub_element = NULL;
+    qn1 = NULL;
+    uri = NULL;
+    
+    sub_element = AXIS2_XML_SCHEMA_OBJ_COLLECTION_GET_ITEM(items, env, 0);
+    
+    CuAssertPtrNotNull(tc, sub_element);
+    
+    qn1 = AXIS2_XML_SCHEMA_ELEMENT_GET_QNAME(sub_element, env);
+    
+    CuAssertPtrNotNull(tc, qn1);
+    
+    uri = AXIS2_QNAME_GET_URI(qn1, env);
+    
+    CuAssertPtrNotNull(tc, uri);
+    
+}
+
+static axis2_om_document_t* 
+get_root_element_from_filename(
+        const axis2_env_t *env, 
+        axis2_char_t *filename)
+{
+    axis2_xml_reader_t *reader = NULL;
+    axis2_om_stax_builder_t *om_builder = NULL;
+    axis2_om_document_t *doc   = NULL;
+
+    reader = axis2_xml_reader_create_for_file(env, filename, NULL);
+    om_builder = axis2_om_stax_builder_create(env, reader);
+    doc = axis2_om_document_create(env, NULL, om_builder); 
+    AXIS2_OM_DOCUMENT_BUILD_ALL(doc, env);
+
+    return doc;    
+}
+

Added: webservices/axis2/trunk/c/woden/test/woden_test.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/woden/test/woden_test.h?rev=412097&view=auto
==============================================================================
--- webservices/axis2/trunk/c/woden/test/woden_test.h (added)
+++ webservices/axis2/trunk/c/woden/test/woden_test.h Tue Jun  6 04:34:34 2006
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+#ifndef XML_SCHEMA_TEST_H
+#define XML_SCHEMA_TEST_H
+
+#include <CuTest.h>
+#include <stdio.h>
+
+CuSuite* xml_schema_GetSuite();
+
+void test_simple_type_schema_generation(CuTest *tc);
+void test_any_attribute(CuTest *tc);
+void test_block_content(CuTest *tc);
+void test_circular_schema(CuTest *tc);
+void test_schema_import1(CuTest *tc);
+void test_schema_import2(CuTest *tc);
+void test_mixed_content(CuTest *tc);
+void test_local_elements(CuTest *tc);
+void test_element_refs(CuTest *tc);
+void test_forward_refs(CuTest *tc);
+void test_local_unnamed_simple_type(CuTest *tc);
+void test_simple_restriction(CuTest *tc);
+void test_unqualified_schemas(CuTest *tc);
+void test_two_schmes(CuTest *tc);
+
+#endif /* XML_SCHEMA_TEST_H */



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org