You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by bi...@apache.org on 2018/04/29 21:15:00 UTC
svn commit: r1830521 [1/2] - in /axis/axis2/c/core/trunk/test: ./ core/addr/
core/clientapi/ core/context/ core/deployment/ core/description/
core/engine/ core/transport/http/ cutest/include/
Author: billblough
Date: Sun Apr 29 21:15:00 2018
New Revision: 1830521
URL: http://svn.apache.org/viewvc?rev=1830521&view=rev
Log:
Convert core tests to use gtest
Added:
axis/axis2/c/core/trunk/test/core/addr/test_addr.cc
- copied, changed from r1830516, axis/axis2/c/core/trunk/test/core/addr/test_addr.c
axis/axis2/c/core/trunk/test/core/clientapi/test_client.cc
- copied, changed from r1830516, axis/axis2/c/core/trunk/test/core/clientapi/test_client.c
axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc
- copied, changed from r1830516, axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.c
axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.cc
- copied, changed from r1830516, axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.c
axis/axis2/c/core/trunk/test/core/context/test_context.cc
- copied, changed from r1830516, axis/axis2/c/core/trunk/test/core/context/test_context.c
axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc
- copied, changed from r1830516, axis/axis2/c/core/trunk/test/core/deployment/test_deployment.c
axis/axis2/c/core/trunk/test/core/description/test_description.cc
axis/axis2/c/core/trunk/test/core/engine/test_engine.cc
axis/axis2/c/core/trunk/test/core/transport/http/test_http_transport.cc
- copied, changed from r1830516, axis/axis2/c/core/trunk/test/core/transport/http/test_http_transport.c
Removed:
axis/axis2/c/core/trunk/test/core/addr/test_addr.c
axis/axis2/c/core/trunk/test/core/clientapi/test_client.c
axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.c
axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.c
axis/axis2/c/core/trunk/test/core/context/test_context.c
axis/axis2/c/core/trunk/test/core/deployment/test_deployment.c
axis/axis2/c/core/trunk/test/core/description/test_description.c
axis/axis2/c/core/trunk/test/core/engine/test_engine.c
axis/axis2/c/core/trunk/test/core/transport/http/test_http_transport.c
Modified:
axis/axis2/c/core/trunk/test/Makefile.am
axis/axis2/c/core/trunk/test/core/addr/Makefile.am
axis/axis2/c/core/trunk/test/core/clientapi/Makefile.am
axis/axis2/c/core/trunk/test/core/context/Makefile.am
axis/axis2/c/core/trunk/test/core/deployment/Makefile.am
axis/axis2/c/core/trunk/test/core/description/Makefile.am
axis/axis2/c/core/trunk/test/core/engine/Makefile.am
axis/axis2/c/core/trunk/test/core/transport/http/Makefile.am
axis/axis2/c/core/trunk/test/cutest/include/cut_http_server.h
Modified: axis/axis2/c/core/trunk/test/Makefile.am
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/Makefile.am?rev=1830521&r1=1830520&r2=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/Makefile.am (original)
+++ axis/axis2/c/core/trunk/test/Makefile.am Sun Apr 29 21:15:00 2018
@@ -14,4 +14,3 @@
# limitations under the License.
TESTS =
SUBDIRS = core
-noinst_HEADERS = cutest/include/cut_defs.h cutest/include/cut_http_server.h
Modified: axis/axis2/c/core/trunk/test/core/addr/Makefile.am
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/addr/Makefile.am?rev=1830521&r1=1830520&r2=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/addr/Makefile.am (original)
+++ axis/axis2/c/core/trunk/test/core/addr/Makefile.am Sun Apr 29 21:15:00 2018
@@ -17,7 +17,7 @@ check_PROGRAMS = test_addr
noinst_PROGRAMS = test_addr
SUBDIRS =
AM_CFLAGS = -g
-test_addr_SOURCES = test_addr.c
+test_addr_SOURCES = test_addr.cc
test_addr_LDADD = \
../../../util/src/libaxutil.la \
@@ -25,12 +25,14 @@ test_addr_LDADD = \
../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
$(top_builddir)/neethi/src/libneethi.la \
$(top_builddir)/src/core/engine/libaxis2_engine.la \
- $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
-INCLUDES = -I$(CUTEST_HOME)/include \
+AM_CPPFLAGS = \
-I$(top_builddir)/src/xml/guththila \
-I$(top_builddir)/include \
-I ../../../util/include \
-I ../../../axiom/include \
- -I ../../cutest/include
+ -I $(GTEST_DIR)/include
Copied: axis/axis2/c/core/trunk/test/core/addr/test_addr.cc (from r1830516, axis/axis2/c/core/trunk/test/core/addr/test_addr.c)
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/addr/test_addr.cc?p2=axis/axis2/c/core/trunk/test/core/addr/test_addr.cc&p1=axis/axis2/c/core/trunk/test/core/addr/test_addr.c&r1=1830516&r2=1830521&rev=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/addr/test_addr.c (original)
+++ axis/axis2/c/core/trunk/test/core/addr/test_addr.cc Sun Apr 29 21:15:00 2018
@@ -15,17 +15,48 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <gtest/gtest.h>
#include <axis2_msg_info_headers.h>
#include <axutil_env.h>
#include <axutil_allocator.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
#include <axis2_endpoint_ref.h>
#include <stdio.h>
-#include <cut_defs.h>
-void
-axis2_test_msg_info_headers(axutil_env_t *env)
+
+class TestAddr: public ::testing::Test
+{
+
+ protected:
+ void SetUp()
+ {
+
+ m_allocator = axutil_allocator_init(NULL);
+ m_axis_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_axis_log);
+
+ }
+
+ void TearDown()
+ {
+ axutil_env_free(m_env);
+ }
+
+
+ axutil_allocator_t *m_allocator = NULL;
+ axutil_env_t *m_env = NULL;
+ axutil_error_t *m_error = NULL;
+ axutil_log_t *m_axis_log = NULL;
+
+};
+
+TEST_F(TestAddr, test_msg_info_headers)
{
+
axis2_endpoint_ref_t *to = NULL;
axis2_endpoint_ref_t *from = NULL;
axis2_endpoint_ref_t *reply_to = NULL;
@@ -35,63 +66,51 @@ axis2_test_msg_info_headers(axutil_env_t
axis2_msg_info_headers_t *axis2_msg_info_headers = NULL;
axis2_char_t *action = "test action";
const axis2_char_t *get_action = NULL;
- to = axis2_endpoint_ref_create(env, "to");
- from = axis2_endpoint_ref_create(env, "from");
- reply_to = axis2_endpoint_ref_create(env, "reply to");
- fault_to = axis2_endpoint_ref_create(env, "fault to");
-
- axis2_msg_info_headers = axis2_msg_info_headers_create(env, NULL, action);
- CUT_ASSERT_PTR_NOT_EQUAL(axis2_msg_info_headers, NULL, 1);
- status = axis2_msg_info_headers_set_to(axis2_msg_info_headers, env, to);
- CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 1);
+ to = axis2_endpoint_ref_create(m_env, "to");
+ from = axis2_endpoint_ref_create(m_env, "from");
+ reply_to = axis2_endpoint_ref_create(m_env, "reply to");
+ fault_to = axis2_endpoint_ref_create(m_env, "fault to");
+
+ axis2_msg_info_headers = axis2_msg_info_headers_create(m_env, NULL, action);
+ ASSERT_NE(axis2_msg_info_headers, nullptr);
+ status = axis2_msg_info_headers_set_to(axis2_msg_info_headers, m_env, to);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
axis2_endpoint_ref =
- axis2_msg_info_headers_get_to(axis2_msg_info_headers, env);
- CUT_ASSERT_PTR_NOT_EQUAL(axis2_endpoint_ref, NULL, 1);
+ axis2_msg_info_headers_get_to(axis2_msg_info_headers, m_env);
+ ASSERT_NE(axis2_endpoint_ref, nullptr);
- status = axis2_msg_info_headers_set_from(axis2_msg_info_headers, env, from);
- CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 1);
+ status = axis2_msg_info_headers_set_from(axis2_msg_info_headers, m_env, from);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
axis2_endpoint_ref =
- axis2_msg_info_headers_get_from(axis2_msg_info_headers, env);
- CUT_ASSERT_PTR_NOT_EQUAL(axis2_endpoint_ref, NULL, 1);
+ axis2_msg_info_headers_get_from(axis2_msg_info_headers, m_env);
+ ASSERT_NE(axis2_endpoint_ref, nullptr);
axis2_endpoint_ref =
- axis2_msg_info_headers_get_reply_to(axis2_msg_info_headers, env);
- CUT_ASSERT_PTR_EQUAL(axis2_endpoint_ref, NULL, 0);
+ axis2_msg_info_headers_get_reply_to(axis2_msg_info_headers, m_env);
+ ASSERT_EQ(axis2_endpoint_ref, nullptr);
status =
- axis2_msg_info_headers_set_reply_to(axis2_msg_info_headers, env, reply_to);
- CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 1);
+ axis2_msg_info_headers_set_reply_to(axis2_msg_info_headers, m_env, reply_to);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
axis2_endpoint_ref =
- axis2_msg_info_headers_get_reply_to(axis2_msg_info_headers, env);
- CUT_ASSERT_PTR_NOT_EQUAL(axis2_endpoint_ref, NULL, 1);
+ axis2_msg_info_headers_get_reply_to(axis2_msg_info_headers, m_env);
+ ASSERT_NE(axis2_endpoint_ref, nullptr);
status =
- axis2_msg_info_headers_set_fault_to(axis2_msg_info_headers, env, fault_to);
- CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0);
+ axis2_msg_info_headers_set_fault_to(axis2_msg_info_headers, m_env, fault_to);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
axis2_endpoint_ref =
- axis2_msg_info_headers_get_fault_to(axis2_msg_info_headers, env);
- CUT_ASSERT_PTR_NOT_EQUAL(axis2_endpoint_ref, NULL, 0);
+ axis2_msg_info_headers_get_fault_to(axis2_msg_info_headers, m_env);
+ ASSERT_NE(axis2_endpoint_ref, nullptr);
- get_action = axis2_msg_info_headers_get_action(axis2_msg_info_headers, env);
- CUT_ASSERT_STR_EQUAL(get_action, action, 0);
-
- status =
- axis2_msg_info_headers_set_action(axis2_msg_info_headers, env, action);
- CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0);
+ get_action = axis2_msg_info_headers_get_action(axis2_msg_info_headers, m_env);
+ ASSERT_STREQ(get_action, action);
- axis2_msg_info_headers_free(axis2_msg_info_headers, env);
-}
+ status =
+ axis2_msg_info_headers_set_action(axis2_msg_info_headers, m_env, action);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
-int main()
-{
- axutil_env_t *env = cut_setup_env("Core Addr");
- CUT_ASSERT(env != NULL);
- if (env) {
- axis2_test_msg_info_headers(env);
- axutil_env_free(env);
- }
- CUT_RETURN_ON_FAILURE(-1);
- return 0;
+ axis2_msg_info_headers_free(axis2_msg_info_headers, m_env);
}
Modified: axis/axis2/c/core/trunk/test/core/clientapi/Makefile.am
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/clientapi/Makefile.am?rev=1830521&r1=1830520&r2=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/clientapi/Makefile.am (original)
+++ axis/axis2/c/core/trunk/test/core/clientapi/Makefile.am Sun Apr 29 21:15:00 2018
@@ -17,32 +17,36 @@ noinst_PROGRAMS = test_client test_clien
check_PROGRAMS = test_client test_clientapi test_svc_client_handler_count
SUBDIRS =
AM_CFLAGS = -g -pthread
-test_client_SOURCES = test_client.c
-test_clientapi_SOURCES = test_clientapi.c
-test_svc_client_handler_count_SOURCES = test_svc_client_handler_count.c
+test_client_SOURCES = test_client.cc
+test_clientapi_SOURCES = test_clientapi.cc
+test_svc_client_handler_count_SOURCES = test_svc_client_handler_count.cc
test_clientapi_LDADD = \
../../../util/src/libaxutil.la \
../../../axiom/src/om/libaxis2_axiom.la \
../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
- $(top_builddir)/neethi/src/libneethi.la \
+ $(top_builddir)/neethi/src/libneethi.la \
-lpthread \
$(top_builddir)/src/core/engine/libaxis2_engine.la \
$(top_builddir)/src/core/transport/http/sender/libaxis2_http_sender.la \
- $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
test_client_LDADD = \
../../../util/src/libaxutil.la \
../../../axiom/src/om/libaxis2_axiom.la \
../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
- $(top_builddir)/neethi/src/libneethi.la \
+ $(top_builddir)/neethi/src/libneethi.la \
-lpthread \
$(top_builddir)/src/core/engine/libaxis2_engine.la \
$(top_builddir)/src/core/transport/http/util/libaxis2_http_util.la \
$(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
- $(top_builddir)/src/core/transport/http/receiver/libaxis2_http_receiver.la \
+ $(top_builddir)/src/core/transport/http/receiver/libaxis2_http_receiver.la \
$(top_builddir)/src/core/transport/http/sender/libaxis2_http_sender.la \
- $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
test_svc_client_handler_count_LDADD = \
../../../util/src/libaxutil.la \
@@ -52,10 +56,12 @@ test_svc_client_handler_count_LDADD =
-lpthread \
$(top_builddir)/src/core/engine/libaxis2_engine.la \
$(top_builddir)/src/core/transport/http/sender/libaxis2_http_sender.la \
- $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
-INCLUDES = -I$(CUTEST_HOME)/include \
+AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_builddir)/src/core/description \
-I$(top_builddir)/src/core/context \
@@ -66,5 +72,5 @@ INCLUDES = -I$(CUTEST_HOME)/include \
-I ../../../util/include \
-I ../../../neethi/include \
-I ../../../axiom/include \
- -I ../../cutest/include
+ -I $(GTEST_DIR)/include
Copied: axis/axis2/c/core/trunk/test/core/clientapi/test_client.cc (from r1830516, axis/axis2/c/core/trunk/test/core/clientapi/test_client.c)
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/clientapi/test_client.cc?p2=axis/axis2/c/core/trunk/test/core/clientapi/test_client.cc&p1=axis/axis2/c/core/trunk/test/core/clientapi/test_client.c&r1=1830516&r2=1830521&rev=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/clientapi/test_client.c (original)
+++ axis/axis2/c/core/trunk/test/core/clientapi/test_client.cc Sun Apr 29 21:15:00 2018
@@ -16,10 +16,11 @@
* limitations under the License.
*/
+#include <gtest/gtest.h>
+
#include <platforms/axutil_platform_auto_sense.h>
#include <axis2_const.h>
-#include <cut_defs.h>
-#include <cut_http_server.h>
+#include "../../cutest/include/cut_http_server.h"
#if defined (WIN32)
#define bcopy(s, d, n) memcpy(d, s, n)
@@ -35,70 +36,63 @@ int write_to_socket(
/* End of function prototypes */
-void
-error(
- const char *msg)
-{
- perror(msg);
- exit(-1);
-}
-void
-axis2_test_temp(axutil_env_t *env)
+class TestClient: public ::testing::Test
{
- /* To avoid warning of not using cut_ptr_equal */
- CUT_ASSERT_PTR_EQUAL(NULL, NULL, 0);
- /* To avoid warning of not using cut_int_equal */
- CUT_ASSERT_INT_EQUAL(0, 0, 0);
- /* To avoid warning of not using cut_str_equal */
- CUT_ASSERT_STR_EQUAL("", "", 0);
-}
-int
-main(
- int argc,
- char *argv[])
+ protected:
+ void SetUp()
+ {
+
+ m_allocator = axutil_allocator_init(NULL);
+ m_axis_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_axis_log);
+
+ }
+
+ void TearDown()
+ {
+ axutil_env_free(m_env);
+ }
+
+
+ axutil_allocator_t *m_allocator = NULL;
+ axutil_env_t *m_env = NULL;
+ axutil_error_t *m_error = NULL;
+ axutil_log_t *m_axis_log = NULL;
+
+};
+
+/* Note: This test fails unless you have a deployed axis2c instance running the
+ * echo service on the appropriate port, and AXIS2C_HOME defined in your
+ * environment */
+TEST_F(TestClient, test_client)
{
const axis2_char_t *hostname = "localhost";
const axis2_char_t *port = "9090";
const axis2_char_t *filename = "echo.xml";
const axis2_char_t *endpoint = "/axis2/services/echo/echo";
axutil_env_t *env = NULL;
-
-#ifndef WIN32
- int c;
- extern char *optarg;
-
- while ((c = getopt(argc, argv, ":h:p:f:e:")) != -1)
- {
- switch (c)
- {
- case 'h':
- hostname = optarg;
- break;
- case 'p':
- port = optarg;
- break;
- case 'f':
- filename = optarg;
- break;
- case 'e':
- endpoint = optarg;
- break;
- }
- }
-#endif
- env = cut_setup_env("test HTTP server");
- CUT_ASSERT(env != NULL);
- if ( ut_start_http_server(env) != 0 ) return -1;
- write_to_socket(hostname, port, filename, endpoint);
- ut_stop_http_server(env);
-
- axis2_test_temp(env);
- CUT_RETURN_ON_FAILURE(-1);
- return 0;
+ int server_status;
+
+ server_status = ut_start_http_server(m_env);
+ ASSERT_EQ(server_status, 0);
+ write_to_socket(hostname, port, filename, endpoint);
+ ut_stop_http_server(m_env);
+
}
+void
+error(
+ const char *msg)
+{
+ perror(msg);
+ exit(-1);
+}
+
+
#define TEST_BUF_LEN 4999
int
write_to_socket(
Copied: axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc (from r1830516, axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.c)
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc?p2=axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc&p1=axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.c&r1=1830516&r2=1830521&rev=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.c (original)
+++ axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc Sun Apr 29 21:15:00 2018
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+#include <gtest/gtest.h>
+
#include <axis2_const.h>
#include <axutil_env.h>
#include <axis2_engine.h>
@@ -28,11 +30,39 @@ axiom_node_t *build_om_payload_for_echo_
const axutil_env_t * env,
const axis2_char_t * echo_str);
-void
-axis2_test_svc_client_blocking(
- )
+class TestClientAPI: public ::testing::Test
+{
+
+ protected:
+ void SetUp()
+ {
+
+ m_allocator = axutil_allocator_init(NULL);
+ m_axis_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_axis_log);
+
+ }
+
+ void TearDown()
+ {
+ axutil_env_free(m_env);
+ }
+
+
+ axutil_allocator_t *m_allocator = NULL;
+ axutil_env_t *m_env = NULL;
+ axutil_error_t *m_error = NULL;
+ axutil_log_t *m_axis_log = NULL;
+
+};
+
+/* Note: This test fails unless you have a deployed axis2c instance running the
+ * echo service on the appropriate port, and AXIS2C_HOME defined in your
+ * environment */
+TEST_F(TestClientAPI, test_svc_client_blocking)
{
- axutil_env_t *env = NULL;
axis2_options_t *options = NULL;
const axis2_char_t *client_home = NULL;
axis2_svc_client_t *svc_client = NULL;
@@ -41,20 +71,18 @@ axis2_test_svc_client_blocking(
const axis2_char_t *address = NULL;
axis2_endpoint_ref_t *endpoint_ref = NULL;
- axutil_allocator_t *allocator = axutil_allocator_init(NULL);
axiom_element_t *result_ele = NULL;
const axis2_char_t *echo_text = "echo_text";
axis2_char_t *result = NULL;
- env = axutil_env_create(allocator);
address = "http://localhost:9090/axis2/services/echo/echo";
- endpoint_ref = axis2_endpoint_ref_create(env, address);
+ endpoint_ref = axis2_endpoint_ref_create(m_env, address);
client_home = AXIS2_GETENV("AXIS2C_HOME");
if (!client_home)
client_home = "../../deploy";
- svc_client = axis2_svc_client_create(env, client_home);
-
+ svc_client = axis2_svc_client_create(m_env, client_home);
+ ASSERT_NE(svc_client, nullptr);
if (!svc_client)
{
printf("axis2_test axis2_svc_client_create FAILURE\n");
@@ -63,20 +91,20 @@ axis2_test_svc_client_blocking(
return;
}
- options = axis2_options_create(env);
- axis2_options_set_to(options, env, endpoint_ref);
- axis2_svc_client_set_options(svc_client, env, options);
+ options = axis2_options_create(m_env);
+ axis2_options_set_to(options, m_env, endpoint_ref);
+ axis2_svc_client_set_options(svc_client, m_env, options);
- payload = build_om_payload_for_echo_svc(env, echo_text);
- ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
+ payload = build_om_payload_for_echo_svc(m_env, echo_text);
+ ret_node = axis2_svc_client_send_receive(svc_client, m_env, payload);
if (ret_node)
{
- if (axiom_node_get_node_type(ret_node, env) == AXIOM_ELEMENT)
+ if (axiom_node_get_node_type(ret_node, m_env) == AXIOM_ELEMENT)
{
- ret_node = axiom_node_get_first_child(ret_node, env);
+ ret_node = axiom_node_get_first_child(ret_node, m_env);
result_ele =
- (axiom_element_t *) axiom_node_get_data_element(ret_node, env);
- result = axiom_element_get_text(result_ele, env, ret_node);
+ (axiom_element_t *) axiom_node_get_data_element(ret_node, m_env);
+ result = axiom_element_get_text(result_ele, m_env, ret_node);
if (!strcmp(result, echo_text))
printf("axis2_test SVC_CLIENT_SEND_RECEIVE SUCCESS\n");
else
@@ -84,7 +112,7 @@ axis2_test_svc_client_blocking(
}
}
- axis2_svc_client_free(svc_client, env);
+ axis2_svc_client_free(svc_client, m_env);
}
/* build SOAP request message content using OM */
@@ -111,10 +139,3 @@ build_om_payload_for_echo_svc(
return echo_om_node;
}
-int
-main(
- )
-{
- axis2_test_svc_client_blocking();
- return 0;
-}
Copied: axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.cc (from r1830516, axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.c)
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.cc?p2=axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.cc&p1=axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.c&r1=1830516&r2=1830521&rev=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.c (original)
+++ axis/axis2/c/core/trunk/test/core/clientapi/test_svc_client_handler_count.cc Sun Apr 29 21:15:00 2018
@@ -15,25 +15,50 @@
* limitations under the License.
*/
+#include <gtest/gtest.h>
+
#include <stdio.h>
#include <axis2_util.h>
#include <axis2_client.h>
-int
-main(
- )
+class TestSvcClientHandler: public ::testing::Test
+{
+
+ protected:
+ void SetUp()
+ {
+
+ m_allocator = axutil_allocator_init(NULL);
+ m_axis_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_axis_log);
+
+ }
+
+ void TearDown()
+ {
+ axutil_env_free(m_env);
+ }
+
+
+ axutil_allocator_t *m_allocator = NULL;
+ axutil_env_t *m_env = NULL;
+ axutil_error_t *m_error = NULL;
+ axutil_log_t *m_axis_log = NULL;
+
+};
+
+
+TEST_F(TestSvcClientHandler, test_count)
{
- axutil_env_t *env =
- axutil_env_create_all("hello_client.log", AXIS2_LOG_LEVEL_TRACE);
const int TIMES = 1000;
int i;
for (i = 1; i <= TIMES; ++i)
{
axis2_svc_client_t *svc_client =
- axis2_svc_client_create(env, AXIS2_GETENV("AXIS2C_HOME"));
- axis2_svc_client_free(svc_client, env);
+ axis2_svc_client_create(m_env, AXIS2_GETENV("AXIS2C_HOME"));
+ axis2_svc_client_free(svc_client, m_env);
printf("%d\n", i);
}
- axutil_env_free(env);
- return 0;
}
Modified: axis/axis2/c/core/trunk/test/core/context/Makefile.am
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/context/Makefile.am?rev=1830521&r1=1830520&r2=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/context/Makefile.am (original)
+++ axis/axis2/c/core/trunk/test/core/context/Makefile.am Sun Apr 29 21:15:00 2018
@@ -17,7 +17,7 @@ check_PROGRAMS = test_context
noinst_PROGRAMS = test_context
SUBDIRS =
AM_CFLAGS = -g
-test_context_SOURCES = test_context.c
+test_context_SOURCES = test_context.cc
test_context_LDADD = ../../../util/src/libaxutil.la \
@@ -25,12 +25,14 @@ test_context_LDADD = ../../../util/src
../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
$(top_builddir)/src/core/engine/libaxis2_engine.la \
$(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
- $(top_builddir)/neethi/src/libneethi.la
+ $(top_builddir)/neethi/src/libneethi.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
-INCLUDES = -I$(CUTEST_HOME)/include \
+AM_CPPFLAGS = \
-I$(top_builddir)/src/xml/guththila/src \
-I$(top_builddir)/include \
-I$(top_builddir)/src/core/description \
-I ../../../util/include \
-I ../../../axiom/include \
- -I ../../cutest/include
+ -I $(GTEST_DIR)/include
Copied: axis/axis2/c/core/trunk/test/core/context/test_context.cc (from r1830516, axis/axis2/c/core/trunk/test/core/context/test_context.c)
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/context/test_context.cc?p2=axis/axis2/c/core/trunk/test/core/context/test_context.cc&p1=axis/axis2/c/core/trunk/test/core/context/test_context.c&r1=1830516&r2=1830521&rev=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/context/test_context.c (original)
+++ axis/axis2/c/core/trunk/test/core/context/test_context.cc Sun Apr 29 21:15:00 2018
@@ -16,18 +16,48 @@
* limitations under the License.
*/
+#include <gtest/gtest.h>
+
#include <axis2_conf_ctx.h>
#include <axis2_svc_grp.h>
#include <axis2_const.h>
#include <axutil_allocator.h>
#include <axutil_env.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
#include <stdio.h>
-#include <cut_defs.h>
-void
-axis2_test_conf_ctx_init(axutil_env_t *env
- )
+class TestContext: public ::testing::Test
{
+
+ protected:
+ void SetUp()
+ {
+
+ m_allocator = axutil_allocator_init(NULL);
+ m_axis_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_axis_log);
+
+ }
+
+ void TearDown()
+ {
+ axutil_env_free(m_env);
+ }
+
+
+ axutil_allocator_t *m_allocator = NULL;
+ axutil_env_t *m_env = NULL;
+ axutil_error_t *m_error = NULL;
+ axutil_log_t *m_axis_log = NULL;
+
+};
+
+TEST_F(TestContext, test_conf_ctx_init)
+{
+
struct axis2_conf *conf = NULL;
struct axis2_svc_grp_ctx *svc_grp_ctx1 = NULL;
struct axis2_svc_grp_ctx *svc_grp_ctx2 = NULL;
@@ -48,56 +78,56 @@ axis2_test_conf_ctx_init(axutil_env_t *e
struct axutil_hash_t *svc_grp_ctx_map = NULL;
axis2_status_t status = AXIS2_FAILURE;
- conf = axis2_conf_create(env);
- CUT_ASSERT_PTR_NOT_EQUAL(conf, NULL, 1);
+ conf = axis2_conf_create(m_env);
+ ASSERT_NE(conf, nullptr);
- conf_ctx = axis2_conf_ctx_create(env, conf);
- CUT_ASSERT_PTR_NOT_EQUAL(conf_ctx, NULL, 1);
+ conf_ctx = axis2_conf_ctx_create(m_env, conf);
+ ASSERT_NE(conf_ctx, nullptr);
- svc_grp1 = axis2_svc_grp_create(env);
- CUT_ASSERT_PTR_NOT_EQUAL(svc_grp1, NULL, 0);
- svc_grp2 = axis2_svc_grp_create(env);
- CUT_ASSERT_PTR_NOT_EQUAL(svc_grp2, NULL, 0);
-
- svc_grp_ctx1 = axis2_svc_grp_ctx_create(env, svc_grp1, conf_ctx);
- CUT_ASSERT_PTR_NOT_EQUAL(svc_grp_ctx1, NULL, 0);
- svc_grp_ctx2 = axis2_svc_grp_ctx_create(env, svc_grp2, conf_ctx);
- CUT_ASSERT_PTR_NOT_EQUAL(svc_grp_ctx2, NULL, 0);
-
- qname1 = axutil_qname_create(env, "name1", NULL, NULL);
- CUT_ASSERT_PTR_NOT_EQUAL(qname1, NULL, 0);
- qname2 = axutil_qname_create(env, "name2", NULL, NULL);
- CUT_ASSERT_PTR_NOT_EQUAL(qname2, NULL, 0);
-
- svc1 = axis2_svc_create_with_qname(env, qname1);
- CUT_ASSERT_PTR_NOT_EQUAL(svc1, NULL, 0);
- svc2 = axis2_svc_create_with_qname(env, qname2);
- CUT_ASSERT_PTR_NOT_EQUAL(svc2, NULL, 0);
-
- svc_ctx1 = axis2_svc_ctx_create(env, svc1, svc_grp_ctx1);
- CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx1, NULL, 0);
- svc_ctx2 = axis2_svc_ctx_create(env, svc2, svc_grp_ctx2);
- CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx1, NULL, 0);
-
- op = axis2_op_create(env);
- CUT_ASSERT_PTR_NOT_EQUAL(op, NULL, 0);
+ svc_grp1 = axis2_svc_grp_create(m_env);
+ ASSERT_NE(svc_grp1, nullptr);
+ svc_grp2 = axis2_svc_grp_create(m_env);
+ ASSERT_NE(svc_grp2, nullptr);
+
+ svc_grp_ctx1 = axis2_svc_grp_ctx_create(m_env, svc_grp1, conf_ctx);
+ ASSERT_NE(svc_grp_ctx1, nullptr);
+ svc_grp_ctx2 = axis2_svc_grp_ctx_create(m_env, svc_grp2, conf_ctx);
+ ASSERT_NE(svc_grp_ctx2, nullptr);
+
+ qname1 = axutil_qname_create(m_env, "name1", NULL, NULL);
+ ASSERT_NE(qname1, nullptr);
+ qname2 = axutil_qname_create(m_env, "name2", NULL, NULL);
+ ASSERT_NE(qname2, nullptr);
+
+ svc1 = axis2_svc_create_with_qname(m_env, qname1);
+ ASSERT_NE(svc1, nullptr);
+ svc2 = axis2_svc_create_with_qname(m_env, qname2);
+ ASSERT_NE(svc2, nullptr);
+
+ svc_ctx1 = axis2_svc_ctx_create(m_env, svc1, svc_grp_ctx1);
+ ASSERT_NE(svc_ctx1, nullptr);
+ svc_ctx2 = axis2_svc_ctx_create(m_env, svc2, svc_grp_ctx2);
+ ASSERT_NE(svc_ctx1, nullptr);
+
+ op = axis2_op_create(m_env);
+ ASSERT_NE(op, nullptr);
- op_ctx1 = axis2_op_ctx_create(env, op, svc_ctx1);
- CUT_ASSERT_PTR_NOT_EQUAL(op_ctx1, NULL, 0);
+ op_ctx1 = axis2_op_ctx_create(m_env, op, svc_ctx1);
+ ASSERT_NE(op_ctx1, nullptr);
- op_ctx2 = axis2_op_ctx_create(env, op, svc_ctx2);
- CUT_ASSERT_PTR_NOT_EQUAL(op_ctx2, NULL, 0);
+ op_ctx2 = axis2_op_ctx_create(m_env, op, svc_ctx2);
+ ASSERT_NE(op_ctx2, nullptr);
- op_ctx_map = axis2_conf_ctx_get_op_ctx_map(conf_ctx, env);
- CUT_ASSERT_PTR_NOT_EQUAL(op_ctx_map, NULL, 0);
+ op_ctx_map = axis2_conf_ctx_get_op_ctx_map(conf_ctx, m_env);
+ ASSERT_NE(op_ctx_map, nullptr);
if (op_ctx_map)
{
axutil_hash_set(op_ctx_map, "op_ctx1", AXIS2_HASH_KEY_STRING, op_ctx1);
axutil_hash_set(op_ctx_map, "op_ctx2", AXIS2_HASH_KEY_STRING, op_ctx2);
}
- svc_ctx_map = axis2_conf_ctx_get_svc_ctx_map(conf_ctx, env);
- CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx_map, NULL, 0);
+ svc_ctx_map = axis2_conf_ctx_get_svc_ctx_map(conf_ctx, m_env);
+ ASSERT_NE(svc_ctx_map, nullptr);
if (svc_ctx_map)
{
axutil_hash_set(svc_ctx_map, "svc_ctx1", AXIS2_HASH_KEY_STRING,
@@ -106,8 +136,8 @@ axis2_test_conf_ctx_init(axutil_env_t *e
svc_ctx2);
}
- svc_grp_ctx_map = axis2_conf_ctx_get_svc_grp_ctx_map(conf_ctx, env);
- CUT_ASSERT_PTR_NOT_EQUAL(svc_grp_ctx_map, NULL, 0);
+ svc_grp_ctx_map = axis2_conf_ctx_get_svc_grp_ctx_map(conf_ctx, m_env);
+ ASSERT_NE(svc_grp_ctx_map, nullptr);
if (svc_grp_ctx_map)
{
@@ -117,29 +147,13 @@ axis2_test_conf_ctx_init(axutil_env_t *e
svc_grp_ctx2);
}
- status = axis2_conf_ctx_init(conf_ctx, env, conf);
- CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0);
- printf("Error code : %d\n", env->error->error_number);
+ status = axis2_conf_ctx_init(conf_ctx, m_env, conf);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
+ printf("Error code : %d\n", m_env->error->error_number);
/*
CUT_ASSERT_INT_EQUAL(env->error->status_code, AXIS2_SUCCESS, 0);
*/
-
- /* To avoid warning of not using cut_str_equal */
- CUT_ASSERT_STR_EQUAL("", "", 0);
- axis2_conf_ctx_free(conf_ctx, env);
+ axis2_conf_ctx_free(conf_ctx, m_env);
}
-int
-main(
- )
-{
- axutil_env_t *env = cut_setup_env("Context");
- CUT_ASSERT(env != NULL);
- if (env) {
- axis2_test_conf_ctx_init(env);
- axutil_env_free(env);
- }
- CUT_RETURN_ON_FAILURE(-1);
- return 0;
-}
Modified: axis/axis2/c/core/trunk/test/core/deployment/Makefile.am
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/deployment/Makefile.am?rev=1830521&r1=1830520&r2=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/deployment/Makefile.am (original)
+++ axis/axis2/c/core/trunk/test/core/deployment/Makefile.am Sun Apr 29 21:15:00 2018
@@ -16,7 +16,7 @@ TESTS = test_deployment
noinst_PROGRAMS = test_deployment
SUBDIRS =
AM_CFLAGS = $(CFLAGS) -g
-test_deployment_SOURCES = test_deployment.c
+test_deployment_SOURCES = test_deployment.cc
test_deployment_LDADD = \
../../../util/src/libaxutil.la \
@@ -24,10 +24,11 @@ test_deployment_LDADD = \
../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
$(top_builddir)/neethi/src/libneethi.la \
$(top_builddir)/src/core/engine/libaxis2_engine.la \
- $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
-INCLUDES = -I ../../../include \
- -I$(CUTEST_HOME)/include \
+AM_CPPFLAGS = -I ../../../include \
-I ../../../src/core/description \
-I ../../../src/core/context \
-I ../../../src/core/phaseresolver \
@@ -38,4 +39,4 @@ INCLUDES = -I ../../../include \
-I ../../../util/include \
-I ../../../axiom/include \
-I ../../../neethi/include \
- -I ../../cutest/include
+ -I $(GTEST_DIR)/include
Copied: axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc (from r1830516, axis/axis2/c/core/trunk/test/core/deployment/test_deployment.c)
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc?p2=axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc&p1=axis/axis2/c/core/trunk/test/core/deployment/test_deployment.c&r1=1830516&r2=1830521&rev=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/deployment/test_deployment.c (original)
+++ axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc Sun Apr 29 21:15:00 2018
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+#include <gtest/gtest.h>
+
#include <stdio.h>
#include <axis2_op.h>
#include <axis2_module_desc.h>
@@ -31,11 +33,39 @@
#include <axis2_transport_sender.h>
#include <axis2_transport_receiver.h>
#include <axis2_core_utils.h>
-#include <cut_defs.h>
-void
-axis2_test_dep_engine_load(axutil_env_t *env
- )
+class TestDeployment: public ::testing::Test
+{
+
+ protected:
+ void SetUp()
+ {
+
+ m_allocator = axutil_allocator_init(NULL);
+ m_axis_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_axis_log);
+
+ }
+
+ void TearDown()
+ {
+ axutil_env_free(m_env);
+ }
+
+
+ axutil_allocator_t *m_allocator = NULL;
+ axutil_env_t *m_env = NULL;
+ axutil_error_t *m_error = NULL;
+ axutil_log_t *m_axis_log = NULL;
+
+};
+
+
+/* Note: AXIS2C_HOME must be set to a valid axis2c deployment in order for
+ * this test to pass */
+TEST_F(TestDeployment, test_dep_engine_load)
{
axis2_dep_engine_t *dep_engine = NULL;
axis2_conf_t *conf = NULL;
@@ -44,20 +74,20 @@ axis2_test_dep_engine_load(axutil_env_t
axis2_char_t *axis2c_home = NULL;
axis2c_home = AXIS2_GETENV("AXIS2C_HOME");
- dep_engine = axis2_dep_engine_create_with_repos_name(env, axis2c_home);
- CUT_ASSERT_PTR_NOT_EQUAL(dep_engine, NULL, 1);
- conf = axis2_dep_engine_load(dep_engine, env);
- axis2_conf_set_dep_engine(conf, env, dep_engine);
- CUT_ASSERT_PTR_NOT_EQUAL(conf, NULL, 1);
- svc_map = axis2_conf_get_all_svcs(conf, env);
- CUT_ASSERT_PTR_NOT_EQUAL(svc_map, NULL, 0);
+ dep_engine = axis2_dep_engine_create_with_repos_name(m_env, axis2c_home);
+ ASSERT_NE(dep_engine, nullptr);
+ conf = axis2_dep_engine_load(dep_engine, m_env);
+ axis2_conf_set_dep_engine(conf, m_env, dep_engine);
+ ASSERT_NE(conf, nullptr);
+ svc_map = axis2_conf_get_all_svcs(conf, m_env);
+ ASSERT_NE(svc_map, nullptr);
if (svc_map)
{
axutil_hash_index_t *hi = NULL;
void *service = NULL;
printf("svc_map count = %d\n", axutil_hash_count(svc_map));
- for (hi = axutil_hash_first(svc_map, env);
- hi; hi = axutil_hash_next(env, hi))
+ for (hi = axutil_hash_first(svc_map, m_env);
+ hi; hi = axutil_hash_next(m_env, hi))
{
axutil_hash_t *ops = NULL;
axis2_svc_t *svc = NULL;
@@ -66,12 +96,12 @@ axis2_test_dep_engine_load(axutil_env_t
axutil_hash_this(hi, NULL, NULL, &service);
svc = (axis2_svc_t *) service;
impl_info_param =
- axis2_svc_get_param(svc, env, AXIS2_SERVICE_CLASS);
+ axis2_svc_get_param(svc, m_env, AXIS2_SERVICE_CLASS);
if (!impl_info_param)
{
printf("imple_info_param is null\n");
}
- ops = axis2_svc_get_all_ops(svc, env);
+ ops = axis2_svc_get_all_ops(svc, m_env);
if (ops)
{
axutil_hash_index_t *hi2 = NULL;
@@ -79,8 +109,8 @@ axis2_test_dep_engine_load(axutil_env_t
axis2_char_t *oname = NULL;
printf("ops count = %d\n", axutil_hash_count(ops));
- for (hi2 = axutil_hash_first(ops, env); hi2;
- hi2 = axutil_hash_next(env, hi2))
+ for (hi2 = axutil_hash_first(ops, m_env); hi2;
+ hi2 = axutil_hash_next(m_env, hi2))
{
if (!hi2)
break;
@@ -88,8 +118,8 @@ axis2_test_dep_engine_load(axutil_env_t
if (op)
{
const axutil_qname_t *qname = NULL;
- qname = axis2_op_get_qname((axis2_op_t *) op, env);
- oname = axutil_qname_get_localpart(qname, env);
+ qname = axis2_op_get_qname((axis2_op_t *) op, m_env);
+ oname = axutil_qname_get_localpart(qname, m_env);
printf("op name = %s\n", oname);
}
}
@@ -100,20 +130,17 @@ axis2_test_dep_engine_load(axutil_env_t
}
in_phases =
- axis2_conf_get_in_phases_upto_and_including_post_dispatch(conf, env);
- CUT_ASSERT_PTR_NOT_EQUAL(in_phases, NULL, 0);
- CUT_ASSERT_INT_EQUAL(env->error->status_code, AXIS2_SUCCESS, 0);
-
- /* To avoid warning of not using cut_str_equal */
- CUT_ASSERT_STR_EQUAL("", "", 0);
+ axis2_conf_get_in_phases_upto_and_including_post_dispatch(conf, m_env);
+ ASSERT_NE(in_phases, nullptr);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
- axis2_conf_free(conf, env);
+ axis2_conf_free(conf, m_env);
}
-int
-axis2_test_transport_receiver_load(axutil_env_t *env
- )
+/* Note: AXIS2C_HOME must be set to a valid axis2c deployment in order for
+ * this test to pass */
+TEST_F(TestDeployment, test_transport_receiver_load)
{
axutil_dll_desc_t *dll_desc = NULL;
axis2_char_t *dll_name = NULL;
@@ -126,30 +153,29 @@ axis2_test_transport_receiver_load(axuti
printf("testing axis2_transport_recv load\n");
printf("******************************************\n");
- dll_desc = axutil_dll_desc_create(env);
+ dll_desc = axutil_dll_desc_create(m_env);
axis2c_home = AXIS2_GETENV("AXIS2C_HOME");
dll_name =
- axutil_stracat(env, axis2c_home, "/lib/libaxis2_http_receiver.so");
+ axutil_stracat(m_env, axis2c_home, "/lib/libaxis2_http_receiver.so");
printf("transport receiver name:%s\n", dll_name);
- axutil_dll_desc_set_name(dll_desc, env, dll_name);
- axutil_dll_desc_set_type(dll_desc, env, AXIS2_TRANSPORT_RECV_DLL);
- impl_info_param = axutil_param_create(env, NULL, NULL);
- axutil_param_set_value(impl_info_param, env, dll_desc);
- axutil_class_loader_init(env);
+ axutil_dll_desc_set_name(dll_desc, m_env, dll_name);
+ axutil_dll_desc_set_type(dll_desc, m_env, AXIS2_TRANSPORT_RECV_DLL);
+ impl_info_param = axutil_param_create(m_env, NULL, NULL);
+ axutil_param_set_value(impl_info_param, m_env, dll_desc);
+ axutil_class_loader_init(m_env);
transport_recv =
- (axis2_transport_receiver_t *) axutil_class_loader_create_dll(env,
+ (axis2_transport_receiver_t *) axutil_class_loader_create_dll(m_env,
impl_info_param);
- is_running = axis2_transport_receiver_is_running(transport_recv, env);
+ ASSERT_NE(transport_recv, nullptr);
+ is_running = axis2_transport_receiver_is_running(transport_recv, m_env);
printf("is_running:%d\n", is_running);
- AXIS2_FREE(env->allocator, dll_name);
+ AXIS2_FREE(m_env->allocator, dll_name);
printf("transport receiver load test successful\n");
- return 0;
}
-int
-axis2_test_transport_sender_load(axutil_env_t *env
- )
+
+TEST_F(TestDeployment, test_transport_sender_load)
{
axutil_dll_desc_t *dll_desc = NULL;
axis2_char_t *dll_name = NULL;
@@ -161,28 +187,25 @@ axis2_test_transport_sender_load(axutil_
printf("testing axis2_transport_sender load\n");
printf("******************************************\n");
- dll_desc = axutil_dll_desc_create(env);
+ dll_desc = axutil_dll_desc_create(m_env);
axis2c_home = AXIS2_GETENV("AXIS2C_HOME");
- dll_name = axutil_stracat(env, axis2c_home, "/lib/libaxis2_http_sender.so");
+ dll_name = axutil_stracat(m_env, axis2c_home, "/lib/libaxis2_http_sender.so");
printf("transport sender name:%s\n", dll_name);
- axutil_dll_desc_set_name(dll_desc, env, dll_name);
- axutil_dll_desc_set_type(dll_desc, env, AXIS2_TRANSPORT_SENDER_DLL);
- impl_info_param = axutil_param_create(env, NULL, NULL);
- axutil_param_set_value(impl_info_param, env, dll_desc);
- axutil_class_loader_init(env);
+ axutil_dll_desc_set_name(dll_desc, m_env, dll_name);
+ axutil_dll_desc_set_type(dll_desc, m_env, AXIS2_TRANSPORT_SENDER_DLL);
+ impl_info_param = axutil_param_create(m_env, NULL, NULL);
+ axutil_param_set_value(impl_info_param, m_env, dll_desc);
+ axutil_class_loader_init(m_env);
/* transport_sender =
- (axis2_transport_sender_t *) */axutil_class_loader_create_dll(env,
+ (axis2_transport_sender_t *) */axutil_class_loader_create_dll(m_env,
impl_info_param);
- AXIS2_FREE(env->allocator, dll_name);
+ AXIS2_FREE(m_env->allocator, dll_name);
printf("transport sender load test successful\n");
- return 0;
}
-void
-axis2_test_default_module_version(axutil_env_t *env
- )
+TEST_F(TestDeployment, test_default_module_version)
{
axis2_conf_t *axis_conf = NULL;
@@ -204,102 +227,87 @@ axis2_test_default_module_version(axutil
axis2_bool_t found3 = AXIS2_FALSE;
- axis_conf = axis2_conf_create(env);
- mod_qname1 = axutil_qname_create(env, "module1", NULL, NULL);
- module1 = axis2_module_desc_create_with_qname(env, mod_qname1);
- axis2_conf_add_module(axis_conf, env, module1);
-
- mod_qname2 = axutil_qname_create(env, "module2-0.90", NULL, NULL);
- module2 = axis2_module_desc_create_with_qname(env, mod_qname2);
- axis2_conf_add_module(axis_conf, env, module2);
-
- mod_qname3 = axutil_qname_create(env, "module2-0.92", NULL, NULL);
- module3 = axis2_module_desc_create_with_qname(env, mod_qname3);
- axis2_conf_add_module(axis_conf, env, module3);
-
- mod_qname4 = axutil_qname_create(env, "module2-0.91", NULL, NULL);
- module4 = axis2_module_desc_create_with_qname(env, mod_qname4);
- axis2_conf_add_module(axis_conf, env, module4);
-
- mod_qname5 = axutil_qname_create(env, "test_module-1.92", NULL, NULL);
- module5 = axis2_module_desc_create_with_qname(env, mod_qname5);
- axis2_conf_add_module(axis_conf, env, module5);
+ axis_conf = axis2_conf_create(m_env);
+ mod_qname1 = axutil_qname_create(m_env, "module1", NULL, NULL);
+ module1 = axis2_module_desc_create_with_qname(m_env, mod_qname1);
+ axis2_conf_add_module(axis_conf, m_env, module1);
+
+ mod_qname2 = axutil_qname_create(m_env, "module2-0.90", NULL, NULL);
+ module2 = axis2_module_desc_create_with_qname(m_env, mod_qname2);
+ axis2_conf_add_module(axis_conf, m_env, module2);
+
+ mod_qname3 = axutil_qname_create(m_env, "module2-0.92", NULL, NULL);
+ module3 = axis2_module_desc_create_with_qname(m_env, mod_qname3);
+ axis2_conf_add_module(axis_conf, m_env, module3);
+
+ mod_qname4 = axutil_qname_create(m_env, "module2-0.91", NULL, NULL);
+ module4 = axis2_module_desc_create_with_qname(m_env, mod_qname4);
+ axis2_conf_add_module(axis_conf, m_env, module4);
+
+ mod_qname5 = axutil_qname_create(m_env, "test_module-1.92", NULL, NULL);
+ module5 = axis2_module_desc_create_with_qname(m_env, mod_qname5);
+ axis2_conf_add_module(axis_conf, m_env, module5);
- axis2_core_utils_calculate_default_module_version(env,
+ axis2_core_utils_calculate_default_module_version(m_env,
axis2_conf_get_all_modules
- (axis_conf, env),
+ (axis_conf, m_env),
axis_conf);
- def_mod = axis2_conf_get_default_module(axis_conf, env, "module1");
- CUT_ASSERT_PTR_EQUAL(def_mod, module1, 0);
- def_mod = axis2_conf_get_default_module(axis_conf, env, "module2-0.92");
- CUT_ASSERT_PTR_EQUAL(def_mod, module3, 0);
- def_mod = axis2_conf_get_default_module(axis_conf, env, "test_module-1.92");
- CUT_ASSERT_PTR_EQUAL(def_mod, module5, 0);
-
- engage_qname = axutil_qname_create(env, "module2-0.92", NULL, NULL);
- axis2_conf_engage_module(axis_conf, env, engage_qname);
- axutil_qname_free(engage_qname, env);
+ def_mod = axis2_conf_get_default_module(axis_conf, m_env, "module1");
+ ASSERT_EQ(def_mod, module1);
+ def_mod = axis2_conf_get_default_module(axis_conf, m_env, "module2-0.92");
+ ASSERT_EQ(def_mod, module3);
+ def_mod = axis2_conf_get_default_module(axis_conf, m_env, "test_module-1.92");
+ ASSERT_EQ(def_mod, module5);
+
+ engage_qname = axutil_qname_create(m_env, "module2-0.92", NULL, NULL);
+ axis2_conf_engage_module(axis_conf, m_env, engage_qname);
+ axutil_qname_free(engage_qname, m_env);
engage_qname = NULL;
- engage_qname = axutil_qname_create(env, "module1", NULL, NULL);
- axis2_conf_engage_module(axis_conf, env, engage_qname);
- axutil_qname_free(engage_qname, env);
+ engage_qname = axutil_qname_create(m_env, "module1", NULL, NULL);
+ axis2_conf_engage_module(axis_conf, m_env, engage_qname);
+ axutil_qname_free(engage_qname, m_env);
engage_qname = NULL;
- axis2_conf_engage_module_with_version(axis_conf, env, "test_module",
+ axis2_conf_engage_module_with_version(axis_conf, m_env, "test_module",
"1.92");
- engaged_modules = axis2_conf_get_all_engaged_modules(axis_conf, env);
- CUT_ASSERT_PTR_NOT_EQUAL(engaged_modules, NULL, 0);
+ engaged_modules = axis2_conf_get_all_engaged_modules(axis_conf, m_env);
+ ASSERT_NE(engaged_modules, nullptr);
if (engaged_modules)
{
int list_size = 0;
int i = 0;
- list_size = axutil_array_list_size(engaged_modules, env);
- CUT_ASSERT_INT_EQUAL(list_size, 3, 0);
+ list_size = axutil_array_list_size(engaged_modules, m_env);
+ ASSERT_EQ(list_size, 3);
for (i = 0; i < list_size; i++)
{
axutil_qname_t *engaged_mod_qname = NULL;
- engaged_mod_qname = axutil_array_list_get(engaged_modules, env, i);
+ engaged_mod_qname = (axutil_qname_t*) axutil_array_list_get(engaged_modules, m_env, i);
if (0 == axutil_strcmp("module2-0.92",
axutil_qname_get_localpart(engaged_mod_qname,
- env)))
+ m_env)))
{
found1 = AXIS2_TRUE;
}
if (0 == axutil_strcmp("module1",
axutil_qname_get_localpart(engaged_mod_qname,
- env)))
+ m_env)))
{
found2 = AXIS2_TRUE;
}
if (0 == axutil_strcmp("test_module-1.92",
axutil_qname_get_localpart(engaged_mod_qname,
- env)))
+ m_env)))
{
found3 = AXIS2_TRUE;
}
}
}
- CUT_ASSERT_INT_NOT_EQUAL(found1, AXIS2_FALSE, 0);
- CUT_ASSERT_INT_NOT_EQUAL(found2, AXIS2_FALSE, 0);
- CUT_ASSERT_INT_NOT_EQUAL(found3, AXIS2_FALSE, 0);
- axis2_conf_free(axis_conf, env);
- CUT_ASSERT_INT_EQUAL(env->error->status_code, AXIS2_SUCCESS, 0);
-}
-
-int
-main(
- )
-{
- axutil_env_t *env = cut_setup_env("Context");
- CUT_ASSERT(env != NULL);
- if (env) {
- axis2_test_dep_engine_load(env);
- axis2_test_default_module_version(env);
- axutil_env_free(env);
- }
- CUT_RETURN_ON_FAILURE(-1);
- return 0;
+ ASSERT_NE(found1, AXIS2_FALSE);
+ ASSERT_NE(found2, AXIS2_FALSE);
+ ASSERT_NE(found3, AXIS2_FALSE);
+ axis2_conf_free(axis_conf, m_env);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
}
Modified: axis/axis2/c/core/trunk/test/core/description/Makefile.am
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/description/Makefile.am?rev=1830521&r1=1830520&r2=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/description/Makefile.am (original)
+++ axis/axis2/c/core/trunk/test/core/description/Makefile.am Sun Apr 29 21:15:00 2018
@@ -16,7 +16,7 @@ TESTS = test_description
noinst_PROGRAMS = test_description
SUBDIRS =
AM_CFLAGS = -g -O2
-test_description_SOURCES = test_description.c
+test_description_SOURCES = test_description.cc
test_description_LDADD = \
../../../util/src/libaxutil.la \
@@ -24,10 +24,11 @@ test_description_LDADD = \
../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
$(top_builddir)/neethi/src/libneethi.la \
$(top_builddir)/src/core/engine/libaxis2_engine.la \
- $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
-INCLUDES = -I$(top_builddir)/include \
- -I$(CUTEST_HOME)/include \
+AM_CPPFLAGS = -I$(top_builddir)/include \
-I$(top_builddir)/src/core/description \
-I$(top_builddir)/src/core/context \
-I$(top_builddir)/src/core/phaseresolver \
@@ -37,5 +38,5 @@ INCLUDES = -I$(top_builddir)/include \
-I$(top_builddir)/src/core/clientapi \
-I ../../../util/include \
-I ../../../axiom/include \
- -I ../../cutest/include
+ -I $(GTEST_DIR)/include
Added: axis/axis2/c/core/trunk/test/core/description/test_description.cc
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/description/test_description.cc?rev=1830521&view=auto
==============================================================================
--- axis/axis2/c/core/trunk/test/core/description/test_description.cc (added)
+++ axis/axis2/c/core/trunk/test/core/description/test_description.cc Sun Apr 29 21:15:00 2018
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 <gtest/gtest.h>
+
+#include <stdio.h>
+#include <axis2_op.h>
+#include <axis2_conf.h>
+#include <axis2_module_desc.h>
+#include <axis2_phases_info.h>
+#include <axutil_env.h>
+#include <axutil_allocator.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+
+class TestDescription: public ::testing::Test
+{
+
+ protected:
+ void SetUp()
+ {
+
+ m_allocator = axutil_allocator_init(NULL);
+ m_axis_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_axis_log);
+
+ }
+
+ void TearDown()
+ {
+ axutil_env_free(m_env);
+ }
+
+
+ axutil_allocator_t *m_allocator = NULL;
+ axutil_env_t *m_env = NULL;
+ axutil_error_t *m_error = NULL;
+ axutil_log_t *m_axis_log = NULL;
+
+};
+
+TEST_F(TestDescription, test_op_engage_module)
+{
+
+ struct axis2_module_desc *moduleref = NULL;
+ axis2_conf_t *conf = NULL;
+ struct axutil_qname *qname = NULL;
+ axis2_op_t *op = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ qname = axutil_qname_create(m_env, "op1", NULL, NULL);
+ ASSERT_NE(qname, nullptr);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+ op = axis2_op_create_with_qname(m_env, qname);
+ ASSERT_NE(op, nullptr);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+
+ moduleref = axis2_module_desc_create(m_env);
+ ASSERT_NE(moduleref, nullptr);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+ conf = axis2_conf_create(m_env);
+ ASSERT_NE(conf, nullptr);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+
+ status = axis2_op_engage_module(op, m_env, moduleref, conf);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
+ /* TODO the following test fails due to an uninitialized array_list.
+ * need to determine best way/location to fix. See AXIS2C-1697 */
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+
+ axis2_op_free(op, m_env);
+}
+
+TEST_F(TestDescription, test_svc_add_module_ops)
+{
+ struct axis2_svc *svc = NULL;
+ struct axutil_qname *qname = NULL;
+ struct axutil_qname *qname1 = NULL;
+ struct axis2_module_desc *module_desc = NULL;
+ struct axis2_conf *axis2_config = NULL;
+
+ axis2_status_t status = AXIS2_FAILURE;
+
+ qname = axutil_qname_create(m_env, "svc1", NULL, NULL);
+ svc = axis2_svc_create_with_qname(m_env, qname);
+ ASSERT_NE(svc, nullptr);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+ qname1 = axutil_qname_create(m_env, "mod1", NULL, NULL);
+ module_desc = axis2_module_desc_create_with_qname(m_env, qname1);
+ ASSERT_NE(module_desc, nullptr);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+ axis2_config = axis2_conf_create(m_env);
+ ASSERT_NE(axis2_config, nullptr);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+ status = axis2_svc_add_module_ops(svc, m_env, module_desc, axis2_config);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+
+ axis2_svc_free(svc, m_env);
+ axis2_module_desc_free(module_desc, m_env);
+ axis2_conf_free(axis2_config, m_env);
+}
+
+TEST_F(TestDescription, test_svc_engage_module)
+{
+ axis2_svc_t *svc = NULL;
+ axutil_qname_t *qname = NULL;
+ axutil_qname_t *qname1 = NULL;
+ axis2_module_desc_t *moduleref = NULL;
+ axis2_conf_t *axis2_config = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ qname = axutil_qname_create(m_env, "svc1", NULL, NULL);
+ svc = axis2_svc_create_with_qname(m_env, qname);
+ qname1 = axutil_qname_create(m_env, "mod1", NULL, NULL);
+ moduleref = axis2_module_desc_create_with_qname(m_env, qname1);
+ axis2_config = axis2_conf_create(m_env);
+
+ status = axis2_svc_engage_module(svc, m_env, moduleref, axis2_config);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+
+ axis2_svc_free(svc, m_env);
+ axis2_conf_free(axis2_config, m_env);
+}
+
+TEST_F(TestDescription, test_svc_get_op)
+{
+ struct axis2_svc *svc = NULL;
+ struct axutil_qname *qname = NULL;
+ struct axutil_hash_t *ops = NULL;
+ struct axis2_op *op = NULL;
+
+ qname = axutil_qname_create(m_env, "op1", NULL, NULL);
+ op = axis2_op_create_with_qname(m_env, qname);
+ qname = axutil_qname_create(m_env, "svc1", NULL, NULL);
+ svc = axis2_svc_create_with_qname(m_env, qname);
+
+ axis2_svc_add_op(svc, m_env, op);
+
+ qname = axutil_qname_create(m_env, "op2", NULL, NULL);
+ op = axis2_op_create_with_qname(m_env, qname);
+ axis2_svc_add_op(svc, m_env, op);
+
+ ops = axis2_svc_get_all_ops(svc, m_env);
+ ASSERT_NE(ops, nullptr);
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+
+ if (ops)
+ {
+ axutil_hash_index_t *hi2 = NULL;
+ void *op2 = NULL;
+ axis2_char_t *oname = NULL;
+ int count = 0;
+ printf("ops count = %d\n", axutil_hash_count(ops));
+
+ for (hi2 = axutil_hash_first(ops, m_env); hi2;
+ hi2 = axutil_hash_next(m_env, hi2))
+ {
+ printf("count = %d \n", count++);
+ axis2_svc_get_all_ops(svc, m_env);
+ if (!(hi2))
+ break;
+ axutil_hash_this(hi2, NULL, NULL, &op2);
+ if (op2)
+ {
+ const axutil_qname_t *qname = NULL;
+ qname = axis2_op_get_qname((axis2_op_t *) op2, m_env);
+ oname = axutil_qname_get_localpart(qname, m_env);
+ printf("op name = %s\n", oname);
+ }
+ }
+ }
+ else
+ printf("ops count = zero\n");
+ ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+
+}
Modified: axis/axis2/c/core/trunk/test/core/engine/Makefile.am
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/engine/Makefile.am?rev=1830521&r1=1830520&r2=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/engine/Makefile.am (original)
+++ axis/axis2/c/core/trunk/test/core/engine/Makefile.am Sun Apr 29 21:15:00 2018
@@ -17,19 +17,20 @@ check_PROGRAMS = test_engine
noinst_PROGRAMS = test_engine
SUBDIRS =
AM_CFLAGS = -g
-test_engine_SOURCES = test_engine.c
+test_engine_SOURCES = test_engine.cc
test_engine_LDADD = \
- ../../../util/src/libaxutil.la \
- ../../../axiom/src/om/libaxis2_axiom.la \
- ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
- $(top_builddir)/src/core/engine/libaxis2_engine.la \
- $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
- $(top_builddir)/neethi/src/libneethi.la
+ ../../../util/src/libaxutil.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/neethi/src/libneethi.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
-INCLUDES = -I$(top_builddir)/src/xml/guththila \
- -I$(CUTEST_HOME)/include \
+AM_CPPFLAGS = -I$(top_builddir)/src/xml/guththila \
-I$(top_builddir)/include \
-I$(top_builddir)/src/core/description \
-I$(top_builddir)/src/core/deployment \
@@ -37,5 +38,5 @@ INCLUDES = -I$(top_builddir)/src/xml/gut
-I ../../../util/include \
-I ../../../axiom/include \
-I ../../../neethi/include \
- -I ../../cutest/include
+ -I $(GTEST_DIR)/include
Added: axis/axis2/c/core/trunk/test/core/engine/test_engine.cc
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/engine/test_engine.cc?rev=1830521&view=auto
==============================================================================
--- axis/axis2/c/core/trunk/test/core/engine/test_engine.cc (added)
+++ axis/axis2/c/core/trunk/test/core/engine/test_engine.cc Sun Apr 29 21:15:00 2018
@@ -0,0 +1,131 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 <gtest/gtest.h>
+
+#include <stdio.h>
+#include <axutil_env.h>
+#include <axis2_engine.h>
+#include <axis2_conf_ctx.h>
+#include <axis2_msg_ctx.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+/* #include <axis2_conf_builder.h> */
+
+class TestEngine: public ::testing::Test
+{
+
+ protected:
+ void SetUp()
+ {
+
+ m_allocator = axutil_allocator_init(NULL);
+ m_axis_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_axis_log);
+
+ }
+
+ void TearDown()
+ {
+ axutil_env_free(m_env);
+ }
+
+
+ axutil_allocator_t *m_allocator = NULL;
+ axutil_env_t *m_env = NULL;
+ axutil_error_t *m_error = NULL;
+ axutil_log_t *m_axis_log = NULL;
+
+};
+
+
+TEST_F(TestEngine, test_engine_send)
+{
+
+ axis2_status_t status = AXIS2_FAILURE;
+ struct axis2_conf *conf = NULL;
+
+ struct axis2_conf_ctx *conf_ctx;
+ struct axis2_msg_ctx *msg_ctx;
+ struct axis2_op_ctx *op_ctx;
+ struct axis2_op *op;
+ struct axis2_svc *svc;
+ struct axis2_svc_ctx *svc_ctx;
+ struct axis2_svc_grp *svc_grp;
+ struct axis2_svc_grp_ctx *svc_grp_ctx;
+ struct axutil_qname *qname;
+ axis2_engine_t *engine = NULL;
+
+ conf = axis2_conf_create(m_env);
+ conf_ctx = axis2_conf_ctx_create(m_env, conf);
+
+ svc_grp = axis2_svc_grp_create(m_env);
+ svc_grp_ctx = axis2_svc_grp_ctx_create(m_env, svc_grp, conf_ctx);
+
+ qname = axutil_qname_create(m_env, "name1", NULL, NULL);
+ svc = axis2_svc_create_with_qname(m_env, qname);
+ svc_ctx = axis2_svc_ctx_create(m_env, svc, svc_grp_ctx);
+
+ op = axis2_op_create(m_env);
+ op_ctx = axis2_op_ctx_create(m_env, op, svc_ctx);
+
+ msg_ctx = axis2_msg_ctx_create(m_env, conf_ctx, NULL, NULL);
+
+ axis2_msg_ctx_set_conf_ctx(msg_ctx, m_env, conf_ctx);
+ axis2_msg_ctx_set_op_ctx(msg_ctx, m_env, op_ctx);
+ axis2_msg_ctx_set_svc_ctx(msg_ctx, m_env, svc_ctx);
+
+ engine = axis2_engine_create(m_env, conf_ctx);
+ status = axis2_engine_send(engine, m_env, msg_ctx);
+ ASSERT_NE(status, AXIS2_SUCCESS);
+ printf("Error code : %d\n", m_env->error->error_number);
+
+ axis2_conf_ctx_free(conf_ctx, m_env);
+ axis2_msg_ctx_free(msg_ctx, m_env);
+ axutil_qname_free(qname, m_env);
+ axis2_svc_grp_ctx_free(svc_grp_ctx, m_env);
+ axis2_svc_ctx_free(svc_ctx, m_env);
+ axis2_svc_free(svc, m_env);
+ axis2_op_ctx_free(op_ctx, m_env);
+ axis2_op_free(op, m_env);
+ axis2_engine_free(engine, m_env);
+}
+
+TEST_F(TestEngine, test_engine_receive)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ axis2_conf_t *conf = NULL;
+ struct axis2_conf_ctx *conf_ctx;
+ struct axis2_msg_ctx *msg_ctx;
+ axis2_engine_t *engine = NULL;
+
+ conf = axis2_conf_create(m_env);
+ conf_ctx = axis2_conf_ctx_create(m_env, conf);
+
+ msg_ctx = axis2_msg_ctx_create(m_env, conf_ctx, NULL, NULL);
+
+ engine = axis2_engine_create(m_env, conf_ctx);
+
+ status = axis2_engine_receive(engine, m_env, msg_ctx);
+ ASSERT_EQ(status, AXIS2_SUCCESS);
+ axis2_conf_ctx_free(conf_ctx, m_env);
+ axis2_msg_ctx_free(msg_ctx, m_env);
+ axis2_engine_free(engine, m_env);
+}
Modified: axis/axis2/c/core/trunk/test/core/transport/http/Makefile.am
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/transport/http/Makefile.am?rev=1830521&r1=1830520&r2=1830521&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/transport/http/Makefile.am (original)
+++ axis/axis2/c/core/trunk/test/core/transport/http/Makefile.am Sun Apr 29 21:15:00 2018
@@ -17,28 +17,30 @@ check_PROGRAMS = test_http_transport
noinst_PROGRAMS = test_http_transport
SUBDIRS =
AM_CFLAGS = -g -pthread
-test_http_transport_SOURCES = test_http_transport.c
+test_http_transport_SOURCES = test_http_transport.cc
-test_http_transport_LDADD = \
- $(LDFLAGS) \
- ../../../../util/src/libaxutil.la \
+test_http_transport_LDADD = \
+ $(LDFLAGS) \
+ ../../../../util/src/libaxutil.la \
../../../../axiom/src/om/libaxis2_axiom.la \
- $(top_builddir)/neethi/src/libneethi.la \
- ../../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
- $(top_builddir)/src/core/engine/libaxis2_engine.la \
- $(top_builddir)/src/core/transport/http/receiver/libaxis2_http_receiver.la \
- $(top_builddir)/src/core/transport/http/sender/libaxis2_http_sender.la \
- $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+ $(top_builddir)/neethi/src/libneethi.la \
+ ../../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/receiver/libaxis2_http_receiver.la \
+ $(top_builddir)/src/core/transport/http/sender/libaxis2_http_sender.la \
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
-INCLUDES = -I$(CUTEST_HOME)/include \
- -I$(top_builddir)/include \
- -I ../../../../util/include \
- -I ../../../../axiom/include \
- -I ../../../cutest/include
+AM_CPPFLAGS = \
+ -I$(top_builddir)/include \
+ -I ../../../../util/include \
+ -I ../../../../axiom/include \
+ -I $(GTEST_DIR)/include
if AXIS2_JSON_ENABLED
test_http_transport_LDADD += $(JSON_LIBS) \
$(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
-INCLUDES += $(JSON_CFLAGS)
+AM_CPPFLAGS += $(JSON_CFLAGS)
endif