axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billblo...@apache.org
Subject svn commit: r1820482 - in /axis/axis2/c/core/trunk/axiom/test/soap: Makefile.am test_soap.c test_soap.cc
Date Sun, 07 Jan 2018 19:43:31 GMT
Author: billblough
Date: Sun Jan  7 19:43:31 2018
New Revision: 1820482

URL: http://svn.apache.org/viewvc?rev=1820482&view=rev
Log:
Switch test_soap to use gtest

Added:
    axis/axis2/c/core/trunk/axiom/test/soap/test_soap.cc
      - copied, changed from r1820481, axis/axis2/c/core/trunk/axiom/test/soap/test_soap.c
Removed:
    axis/axis2/c/core/trunk/axiom/test/soap/test_soap.c
Modified:
    axis/axis2/c/core/trunk/axiom/test/soap/Makefile.am

Modified: axis/axis2/c/core/trunk/axiom/test/soap/Makefile.am
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/test/soap/Makefile.am?rev=1820482&r1=1820481&r2=1820482&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/test/soap/Makefile.am (original)
+++ axis/axis2/c/core/trunk/axiom/test/soap/Makefile.am Sun Jan  7 19:43:31 2018
@@ -17,12 +17,16 @@ noinst_PROGRAMS = test_soap
 check_PROGRAMS = test_soap
 SUBDIRS =
 AM_CFLAGS = -g -O2
-test_soap_SOURCES = test_soap.c
+test_soap_SOURCES = test_soap.cc
 
 test_soap_LDADD   =	../../../util/src/libaxutil.la \
 			$(top_builddir)/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
-			$(top_builddir)/src/om/libaxis2_axiom.la 
+			$(top_builddir)/src/om/libaxis2_axiom.la \
+			$(top_builddir)/$(GTEST)/libgtest.a \
+			$(top_builddir)/$(GTEST)/libgtest_main.a
 
-INCLUDES = -I$(top_builddir)/include \
+AM_CPPFLAGS = -I$(top_builddir)/include \
             -I$(top_builddir)/src/parser \
-			-I ../../../util/include
+			-I ../../../util/include \
+			-I $(GTEST_DIR)/include
+

Copied: axis/axis2/c/core/trunk/axiom/test/soap/test_soap.cc (from r1820481, axis/axis2/c/core/trunk/axiom/test/soap/test_soap.c)
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/test/soap/test_soap.cc?p2=axis/axis2/c/core/trunk/axiom/test/soap/test_soap.cc&p1=axis/axis2/c/core/trunk/axiom/test/soap/test_soap.c&r1=1820481&r2=1820482&rev=1820482&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/test/soap/test_soap.c (original)
+++ axis/axis2/c/core/trunk/axiom/test/soap/test_soap.cc Sun Jan  7 19:43:31 2018
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+#include <gtest/gtest.h>
+
 #include <axiom_stax_builder.h>
 #include <axiom_document.h>
 #include <axiom_node.h>
@@ -62,6 +64,7 @@ read_soap(
     return len;
 }
 
+
 /*int read_soap(char *buffer, int size, void *ctx)
 {
     return fread(buffer, sizeof(char), size, f);
@@ -111,12 +114,41 @@ printnode(
     return 0;
 }
 
-int
-build_soap(
-    const axutil_env_t * env,
-    const char *filename,
-    const axis2_char_t * uri)
+
+/* FIXME 
+ * These tests exercise code, but don't actually check that the output is
+ * correct.  They didn't when they were in the old test format, either.
+ */
+
+class TestSOAP: public ::testing::Test
 {
+    protected:
+        void SetUp()
+        {
+            m_allocator = axutil_allocator_init(NULL);
+            m_log = axutil_log_create(m_allocator, NULL, NULL);
+            m_error = axutil_error_create(m_allocator);
+            m_env = axutil_env_create_with_error_log(m_allocator, m_error, m_log);
+        }
+
+        void TearDown()
+        {
+            axutil_env_free(m_env);
+        }
+
+        axutil_env_t *m_env = NULL;
+        axutil_allocator_t *m_allocator = NULL;
+        axutil_error_t *m_error = NULL;
+        axutil_log_t *m_log = NULL;
+
+};
+
+
+TEST_F(TestSOAP, test_build_soap) {
+
+    const axis2_char_t *uri = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
+    const char *filename = "../resources/xml/soap/test.xml";
+
     axiom_stax_builder_t *om_builder = NULL;
 
     axiom_xml_reader_t *xml_reader = NULL;
@@ -136,142 +168,95 @@ build_soap(
 
     int status = AXIS2_SUCCESS;
 
-    if (!filename)
-        return -1;
     f = fopen(filename, "r");
-    if (!f)
-        return -1;
+    ASSERT_NE(f, nullptr);
+
     printf(" \n\n _________ Test SOAP BUILD ___________ \n\n ");
 
     xml_reader =
-        axiom_xml_reader_create_for_io(env, read_soap, close_soap, NULL, NULL);
-    if (!xml_reader)
-    {
-        printf("%s \n", axutil_error_get_message(env->error));
-        return AXIS2_FAILURE;
-    }
+        axiom_xml_reader_create_for_io(m_env, read_soap, close_soap, NULL, NULL);
 
-    om_builder = axiom_stax_builder_create(env, xml_reader);
-    if (!om_builder)
-    {
-        axiom_xml_reader_free(xml_reader, env);
-        printf("%s \n", axutil_error_get_message(env->error));
-        return AXIS2_FAILURE;
-    }
+    ASSERT_NE(xml_reader, nullptr);
 
-    soap_builder = axiom_soap_builder_create(env, om_builder, uri);
-    if (!soap_builder)
-    {
-        printf("%s \n", axutil_error_get_message(env->error));
-        return AXIS2_FAILURE;
-    }
-    soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
-    if (!soap_envelope)
-    {
-        axiom_soap_builder_free(soap_builder, env);
-        printf("%s \n", axutil_error_get_message(env->error));
-        return AXIS2_FAILURE;
-    }
+    om_builder = axiom_stax_builder_create(m_env, xml_reader);
+    ASSERT_NE(om_builder, nullptr);
 
-    om_node = axiom_soap_envelope_get_base_node(soap_envelope, env);
+    soap_builder = axiom_soap_builder_create(m_env, om_builder, uri);
+    ASSERT_NE(soap_builder, nullptr);
 
-    if (om_node)
-        printnode(om_node, env);
+    soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, m_env);
+    ASSERT_NE(soap_envelope, nullptr);
 
-    soap_header = axiom_soap_envelope_get_header(soap_envelope, env);
-    if (soap_header)
-    {
-        om_node = axiom_soap_header_get_base_node(soap_header, env);
-        if (om_node)
-            printnode(om_node, env);
+    om_node = axiom_soap_envelope_get_base_node(soap_envelope, m_env);
+    ASSERT_NE(om_node, nullptr);
+    printnode(om_node, m_env);
 
-        children_iter =
-            axiom_soap_header_examine_all_header_blocks(soap_header, env);
-        if (children_iter)
-        {
-            /*while (axiom_children_iterator_has_next(children_iter, env))
-               {
-               om_node = axiom_children_iterator_next(children_iter, env);
-               if (om_node)
-               printnode(om_node, env);
-               } */
-        }
-    }
+    soap_header = axiom_soap_envelope_get_header(soap_envelope, m_env);
+    ASSERT_NE(soap_header, nullptr);
+    om_node = axiom_soap_header_get_base_node(soap_header, m_env);
+    ASSERT_NE(om_node, nullptr);
+    printnode(om_node, m_env);
 
-    soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
-    if (soap_body)
+    /* FIXME JIRA: AXIS2C-1695 */
+    /*
+    children_iter =
+        axiom_soap_header_examine_all_header_blocks(soap_header, m_env);
+    if (children_iter)
     {
-        if (axiom_soap_body_has_fault(soap_body, env));
-        printf("axiom_soap_body_has_fault\n");
-        om_node = axiom_soap_body_get_base_node(soap_body, env);
-        if (om_node)
+        while (axiom_children_iterator_has_next(children_iter, env))
+            {
+            om_node = axiom_children_iterator_next(children_iter, env);
+            if (om_node)
             printnode(om_node, env);
-        else
-            printf("\n\n soap body base node null \n\n");
-    }
-    else
-    {
-        printf("%s \n", axutil_error_get_message(env->error));
-        printf("\n\n ERROR soap_body NULL.\n\n");
-        return AXIS2_FAILURE;
+            }
     }
+    */
+
+    soap_body = axiom_soap_envelope_get_body(soap_envelope, m_env);
+    ASSERT_NE(soap_body, nullptr);
+    if (axiom_soap_body_has_fault(soap_body, m_env))
+        printf("axiom_soap_body_has_fault\n");
+    om_node = axiom_soap_body_get_base_node(soap_body, m_env);
+    ASSERT_NE(om_node, nullptr);
+    printnode(om_node, m_env);
 
-    if (axiom_soap_body_has_fault(soap_body, env))
+    if (axiom_soap_body_has_fault(soap_body, m_env))
     {
         printf("\n\nsoap body  has a fault element\n\n\n ");
     }
 
-    om_node = axiom_soap_body_get_base_node(soap_body, env);
-    if (om_node)
+    om_node = axiom_soap_body_get_base_node(soap_body, m_env);
+    ASSERT_NE(om_node, nullptr);
+    while (!(axiom_node_is_complete(om_node, m_env)))
     {
-        while (!(axiom_node_is_complete(om_node, env)))
-        {
-            status = axiom_soap_builder_next(soap_builder, env);
-            if (status == AXIS2_FAILURE)
-            {
-                printf("failure %s", axutil_error_get_message(env->error));
-                return AXIS2_FAILURE;
-            }
-        }
+        status = axiom_soap_builder_next(soap_builder, m_env);
+        ASSERT_NE(status, AXIS2_FAILURE);
     }
 
     xml_writer =
-        axiom_xml_writer_create_for_memory(env, NULL, AXIS2_FALSE, AXIS2_FALSE,
+        axiom_xml_writer_create_for_memory(m_env, NULL, AXIS2_FALSE, AXIS2_FALSE,
                                            AXIS2_XML_PARSER_TYPE_BUFFER);
-    if (!xml_writer)
-    {
-        axiom_soap_builder_free(soap_builder, env);
-        return AXIS2_FAILURE;
-    }
+    ASSERT_NE(xml_writer, nullptr);
 
-    om_output = axiom_output_create(env, xml_writer);
-    if (!om_output)
-    {
-        axiom_soap_builder_free(soap_builder, env);
-        axiom_xml_writer_free(xml_writer, env);
-        return AXIS2_FAILURE;
-    }
+    om_output = axiom_output_create(m_env, xml_writer);
+    ASSERT_NE(om_output, nullptr);
 
-    axiom_soap_envelope_serialize(soap_envelope, env, om_output, AXIS2_FALSE);
+    axiom_soap_envelope_serialize(soap_envelope, m_env, om_output, AXIS2_FALSE);
 
-    buffer = (axis2_char_t *) axiom_xml_writer_get_xml(xml_writer, env);
+    buffer = (axis2_char_t *) axiom_xml_writer_get_xml(xml_writer, m_env);
 
     printf("\n\nThe serialized xml is >>>>>>>>>>>>>\n\n\n%s
\n\n\n", buffer);
 
     if (buffer)
-        AXIS2_FREE(env->allocator, buffer);
+        AXIS2_FREE(m_env->allocator, buffer);
 
-    axiom_soap_envelope_free(soap_envelope, env);
+    axiom_soap_envelope_free(soap_envelope, m_env);
 
     printf(" \n __________ END TEST SOAP BUILD ____________ \n");
-
-    return AXIS2_SUCCESS;
 }
 
-int
-build_soap_programatically(
-    const axutil_env_t * env)
-{
+
+TEST_F(TestSOAP, test_build_programatically) {
     axiom_soap_envelope_t *soap_envelope = NULL;
     axiom_soap_body_t *soap_body = NULL;
     axiom_soap_header_t *soap_header = NULL;
@@ -293,72 +278,69 @@ build_soap_programatically(
     printf(" \n ____________ BUILD SOAP PROGRAMATICALLY _______________ \n");
 
     env_ns =
-        axiom_namespace_create(env, "http://www.w3.org/2003/05/soap-envelope",
+        axiom_namespace_create(m_env, "http://www.w3.org/2003/05/soap-envelope",
                                "env");
     if (!env_ns)
-        return AXIS2_FAILURE;
+    ASSERT_NE(env_ns, nullptr);
 
-    soap_envelope = axiom_soap_envelope_create(env, env_ns);
-    if (!soap_envelope)
-        return AXIS2_FAILURE;
+    soap_envelope = axiom_soap_envelope_create(m_env, env_ns);
+    ASSERT_NE(soap_envelope, nullptr);
 
-    soap_header = axiom_soap_header_create_with_parent(env, soap_envelope);
-    if (!soap_header)
-        return AXIS2_FAILURE;
+    soap_header = axiom_soap_header_create_with_parent(m_env, soap_envelope);
+    ASSERT_NE(soap_header, nullptr);
 
     test_ns =
-        axiom_namespace_create(env, "http://example.org/ts-tests", "test");
+        axiom_namespace_create(m_env, "http://example.org/ts-tests", "test");
 
     role_ns =
-        axiom_namespace_create(env,
+        axiom_namespace_create(m_env,
                                "http://www.w3.org/2003/05/soap-envelope/role/next",
                                "role");
 
     hb1 =
-        axiom_soap_header_block_create_with_parent(env, "echoOk", role_ns,
+        axiom_soap_header_block_create_with_parent(m_env, "echoOk", role_ns,
                                                    soap_header);
 
-    hb_node = axiom_soap_header_block_get_base_node(hb1, env);
+    hb_node = axiom_soap_header_block_get_base_node(hb1, m_env);
 
-    hb_ele = axiom_node_get_data_element(hb_node, env);
+    hb_ele = (axiom_element_t*) axiom_node_get_data_element(hb_node, m_env);
 
-    axiom_element_set_namespace(hb_ele, env, test_ns, hb_node);
+    axiom_element_set_namespace(hb_ele, m_env, test_ns, hb_node);
 
-    soap_body = axiom_soap_body_create_with_parent(env, soap_envelope);
+    soap_body = axiom_soap_body_create_with_parent(m_env, soap_envelope);
 
-    soap_fault = axiom_soap_fault_create_with_parent(env, soap_body);
+    soap_fault = axiom_soap_fault_create_with_parent(m_env, soap_body);
 
-    fault_code = axiom_soap_fault_code_create_with_parent(env, soap_fault);
+    fault_code = axiom_soap_fault_code_create_with_parent(m_env, soap_fault);
 
     xml_writer =
-        axiom_xml_writer_create_for_memory(env, NULL, AXIS2_FALSE, AXIS2_FALSE,
+        axiom_xml_writer_create_for_memory(m_env, NULL, AXIS2_FALSE, AXIS2_FALSE,
                                            AXIS2_XML_PARSER_TYPE_BUFFER);
 
-    om_output = axiom_output_create(env, xml_writer);
+    om_output = axiom_output_create(m_env, xml_writer);
 
-    axiom_soap_envelope_serialize(soap_envelope, env, om_output, AXIS2_FALSE);
+    axiom_soap_envelope_serialize(soap_envelope, m_env, om_output, AXIS2_FALSE);
 
-    buffer = (axis2_char_t *) axiom_xml_writer_get_xml(xml_writer, env);
+    buffer = (axis2_char_t *) axiom_xml_writer_get_xml(xml_writer, m_env);
 
     printf("%s \n", buffer);
 
-    axiom_soap_envelope_free(soap_envelope, env);
+    axiom_soap_envelope_free(soap_envelope, m_env);
 
-    AXIS2_FREE(env->allocator, buffer);
+    AXIS2_FREE(m_env->allocator, buffer);
 
     buffer = NULL;
 
-    axiom_output_free(om_output, env);
+    /* FIXME this causes a double free?
+     * axiom_output_free(om_output, m_env);
+     */
 
     printf("\n __________ END BUILD SOAP PROGRAMATICALLY ____________\n");
 
-    return AXIS2_SUCCESS;
 }
 
-int
-create_soap_fault(
-    const axutil_env_t * env)
-{
+
+TEST_F(TestSOAP, test_create_soap_fault) {
     axiom_soap_envelope_t *soap_envelope = NULL;
     axiom_soap_body_t *soap_body = NULL;
     axiom_soap_fault_t *soap_fault = NULL;
@@ -369,26 +351,26 @@ create_soap_fault(
     axis2_status_t status = 0;
 
     soap_envelope =
-        axiom_soap_envelope_create_default_soap_fault_envelope(env,
+        axiom_soap_envelope_create_default_soap_fault_envelope(m_env,
                                                                "Fault Code",
                                                                "Fault Reason",
                                                                AXIOM_SOAP11,
                                                                NULL, NULL);
-    soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
-    soap_fault = axiom_soap_body_get_fault(soap_body, env);
+    soap_body = axiom_soap_envelope_get_body(soap_envelope, m_env);
+    soap_fault = axiom_soap_body_get_fault(soap_body, m_env);
 
-    axiom_soap_fault_detail_create_with_parent(env, soap_fault);
-    axiom_soap_fault_role_create_with_parent(env, soap_fault);
+    axiom_soap_fault_detail_create_with_parent(m_env, soap_fault);
+    axiom_soap_fault_role_create_with_parent(m_env, soap_fault);
     xml_writer =
-        axiom_xml_writer_create_for_memory(env, NULL, AXIS2_FALSE, AXIS2_FALSE,
+        axiom_xml_writer_create_for_memory(m_env, NULL, AXIS2_FALSE, AXIS2_FALSE,
                                            AXIS2_XML_PARSER_TYPE_BUFFER);
-    om_output = axiom_output_create(env, xml_writer);
-    axiom_soap_envelope_serialize(soap_envelope, env, om_output, AXIS2_FALSE);
-    buffer = (axis2_char_t *) axiom_xml_writer_get_xml(xml_writer, env);
+    om_output = axiom_output_create(m_env, xml_writer);
+    axiom_soap_envelope_serialize(soap_envelope, m_env, om_output, AXIS2_FALSE);
+    buffer = (axis2_char_t *) axiom_xml_writer_get_xml(xml_writer, m_env);
     printf("\n Testing Create soap fault \n %s \n", buffer);
 
-    status = axiom_soap_fault_set_exception(soap_fault, env, "MyNewException");
-    exception_text = axiom_soap_fault_get_exception(soap_fault, env);
+    status = axiom_soap_fault_set_exception(soap_fault, m_env, "MyNewException");
+    exception_text = axiom_soap_fault_get_exception(soap_fault, m_env);
 
     printf(" Testing soap fault set exception \n");
     printf("Actual = %s Expected = %s |", exception_text, "MyNewException");
@@ -397,15 +379,11 @@ create_soap_fault(
     else
         printf("FAILURE\n");
 
-    axiom_soap_envelope_free(soap_envelope, env);
-    axiom_output_free(om_output, env);
-    return 0;
+    axiom_soap_envelope_free(soap_envelope, m_env);
+    axiom_output_free(om_output, m_env);
 }
 
-int
-create_soap_fault_with_exception(
-    const axutil_env_t * env)
-{
+TEST_F(TestSOAP, test_create_soap_fault_with_exception) {
     axiom_soap_envelope_t *soap_envelope = NULL;
     axiom_soap_body_t *soap_body = NULL;
     axiom_soap_fault_t *soap_fault = NULL;
@@ -414,24 +392,24 @@ create_soap_fault_with_exception(
     axis2_char_t *exception_text = NULL;
 
     soap_envelope =
-        axiom_soap_envelope_create_default_soap_fault_envelope(env,
+        axiom_soap_envelope_create_default_soap_fault_envelope(m_env,
                                                                "Fault Code",
                                                                "Fault Reason",
                                                                AXIOM_SOAP11,
                                                                NULL, NULL);
-    soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
+    soap_body = axiom_soap_envelope_get_body(soap_envelope, m_env);
     soap_fault =
-        axiom_soap_fault_create_with_exception(env, soap_body, "MyException");
+        axiom_soap_fault_create_with_exception(m_env, soap_body, "MyException");
 
-    axiom_soap_fault_detail_create_with_parent(env, soap_fault);
-    axiom_soap_fault_role_create_with_parent(env, soap_fault);
+    axiom_soap_fault_detail_create_with_parent(m_env, soap_fault);
+    axiom_soap_fault_role_create_with_parent(m_env, soap_fault);
     xml_writer =
-        axiom_xml_writer_create_for_memory(env, NULL, AXIS2_FALSE, AXIS2_FALSE,
+        axiom_xml_writer_create_for_memory(m_env, NULL, AXIS2_FALSE, AXIS2_FALSE,
                                            AXIS2_XML_PARSER_TYPE_BUFFER);
-    om_output = axiom_output_create(env, xml_writer);
-    axiom_soap_envelope_serialize(soap_envelope, env, om_output, AXIS2_FALSE);
+    om_output = axiom_output_create(m_env, xml_writer);
+    axiom_soap_envelope_serialize(soap_envelope, m_env, om_output, AXIS2_FALSE);
 
-    exception_text = axiom_soap_fault_get_exception(soap_fault, env);
+    exception_text = axiom_soap_fault_get_exception(soap_fault, m_env);
     printf(" Testing Create soap fault with exception \n");
     printf("Actual = %s Expected = %s |", exception_text, "MyException");
     if (0 == strcmp(exception_text, "MyException"))
@@ -439,15 +417,11 @@ create_soap_fault_with_exception(
     else
         printf("FAILURE\n");
 
-    axiom_soap_envelope_free(soap_envelope, env);
-    axiom_output_free(om_output, env);
-    return 0;
+    axiom_soap_envelope_free(soap_envelope, m_env);
+    axiom_output_free(om_output, m_env);
 }
 
-int
-test_soap_fault_node(
-    const axutil_env_t * env)
-{
+TEST_F(TestSOAP, test_soap_fault_node) {
     axiom_soap_envelope_t *soap_envelope = NULL;
     axiom_soap_body_t *soap_body = NULL;
     axiom_soap_fault_t *soap_fault = NULL;
@@ -457,31 +431,28 @@ test_soap_fault_node(
 
     printf("Testing soap fault node \n");
     soap_envelope =
-        axiom_soap_envelope_create_default_soap_fault_envelope(env,
+        axiom_soap_envelope_create_default_soap_fault_envelope(m_env,
                                                                "env:Receiver",
                                                                "Something went wrong!",
                                                                AXIOM_SOAP12,
                                                                NULL, NULL);
-    soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
-    soap_fault = axiom_soap_body_get_fault(soap_body, env);
+    soap_body = axiom_soap_envelope_get_body(soap_envelope, m_env);
+    soap_fault = axiom_soap_body_get_fault(soap_body, m_env);
 
-    fault_node = axiom_soap_fault_node_create_with_parent(env, soap_fault);
-    status = axiom_soap_fault_node_set_value(fault_node, env, "MyFaultNode");
-    node_text = axiom_soap_fault_node_get_value(fault_node, env);
+    fault_node = axiom_soap_fault_node_create_with_parent(m_env, soap_fault);
+    status = axiom_soap_fault_node_set_value(fault_node, m_env, "MyFaultNode");
+    node_text = axiom_soap_fault_node_get_value(fault_node, m_env);
 
     printf("Actual = %s Expected = %s |", node_text, "MyFaultNode");
     if (0 == strcmp(node_text, "MyFaultNode"))
         printf("SUCCESS\n");
     else
         printf("FAILURE\n");
-    axiom_soap_envelope_free(soap_envelope, env);
-    return 0;
+    axiom_soap_envelope_free(soap_envelope, m_env);
 }
 
-int
-test_soap_fault_value(
-    const axutil_env_t * env)
-{
+
+TEST_F(TestSOAP, test_soap_fault_value) {
     axiom_soap_envelope_t *soap_envelope = NULL;
     axiom_soap_body_t *soap_body = NULL;
     axiom_soap_fault_t *soap_fault = NULL;
@@ -491,16 +462,16 @@ test_soap_fault_value(
 
     printf("TEST SOAP FAULT VALUE\n");
     soap_envelope =
-        axiom_soap_envelope_create_default_soap_fault_envelope(env,
+        axiom_soap_envelope_create_default_soap_fault_envelope(m_env,
                                                                "env:Receiver",
                                                                "Something went wrong!",
                                                                AXIOM_SOAP12,
                                                                NULL, NULL);
-    soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
-    soap_fault = axiom_soap_body_get_fault(soap_body, env);
-    soap_code = axiom_soap_fault_get_code(soap_fault, env);
-    value = axiom_soap_fault_code_get_value(soap_code, env);
-    value_text = axiom_soap_fault_value_get_text(value, env);
+    soap_body = axiom_soap_envelope_get_body(soap_envelope, m_env);
+    soap_fault = axiom_soap_body_get_fault(soap_body, m_env);
+    soap_code = axiom_soap_fault_get_code(soap_fault, m_env);
+    value = axiom_soap_fault_code_get_value(soap_code, m_env);
+    value_text = axiom_soap_fault_value_get_text(value, m_env);
 
     printf("Actual = %s Expected = %s |", value_text, "env:Receiver");
     if (0 == strcmp(value_text, "env:Receiver"))
@@ -508,43 +479,6 @@ test_soap_fault_value(
     else
         printf("FAILURE\n");
 
-    axiom_soap_envelope_free(soap_envelope, env);
-    return 0;
+    axiom_soap_envelope_free(soap_envelope, m_env);
 }
 
-int
-main(
-    int argc,
-    char *argv[])
-{
-    axutil_env_t *env = NULL;
-    axutil_allocator_t *allocator = NULL;
-    axutil_error_t *error = NULL;
-    axutil_log_t *log = NULL;
-    const axis2_char_t *uri = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
-    const char *filename = "../resources/xml/soap/test.xml";
-    if (argc > 1)
-        filename = argv[1];
-    if (argc > 2)
-    {
-        if (axutil_strcmp(argv[2], "0") == 0)
-            uri = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI;
-        else if (axutil_strcmp(argv[2], "1") == 0)
-            uri = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
-    }
-    allocator = axutil_allocator_init(NULL);
-    log = axutil_log_create(allocator, NULL, "test_soap.log");
-    log->level = AXIS2_LOG_LEVEL_DEBUG;
-    error = axutil_error_create(allocator);
-    env = axutil_env_create_with_error_log(allocator, error, log);
-
-    axutil_error_init();
-    /*build_soap_programatically(env);   */
-    build_soap(env, filename, uri);
-    create_soap_fault(env);
-    create_soap_fault_with_exception(env);
-    test_soap_fault_node(env);
-    test_soap_fault_value(env);
-    axutil_env_free(env);
-    return 0;
-}



Mime
View raw message