summaryrefslogtreecommitdiffstats
path: root/test/core/context
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/context')
-rw-r--r--test/core/context/Makefile.am7
-rw-r--r--test/core/context/test_context.c55
2 files changed, 42 insertions, 20 deletions
diff --git a/test/core/context/Makefile.am b/test/core/context/Makefile.am
index 52bf04a..b205f3f 100644
--- a/test/core/context/Makefile.am
+++ b/test/core/context/Makefile.am
@@ -11,11 +11,12 @@ test_context_LDADD = ../../../util/src/libaxutil.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)/neethi/src/libneethi.la
-INCLUDES = -I${CUTEST_HOME}/include \
+INCLUDES = -I$(CUTEST_HOME)/include \
-I$(top_builddir)/src/xml/guththila/src \
-I$(top_builddir)/include \
-I$(top_builddir)/src/core/description \
-I ../../../util/include \
- -I ../../../axiom/include
+ -I ../../../axiom/include \
+ -I ../../../cutest/include
diff --git a/test/core/context/test_context.c b/test/core/context/test_context.c
index 253691a..2066ac5 100644
--- a/test/core/context/test_context.c
+++ b/test/core/context/test_context.c
@@ -22,9 +22,10 @@
#include <axutil_allocator.h>
#include <axutil_env.h>
#include <stdio.h>
+#include <cut_defs.h>
void
-axis2_test_conf_ctx_init(
+axis2_test_conf_ctx_init(axutil_env_t *env
)
{
struct axis2_conf *conf = NULL;
@@ -45,38 +46,50 @@ axis2_test_conf_ctx_init(
struct axutil_hash_t *op_ctx_map = NULL;
struct axutil_hash_t *svc_ctx_map = NULL;
struct axutil_hash_t *svc_grp_ctx_map = NULL;
-
axis2_status_t status = AXIS2_FAILURE;
- axutil_allocator_t *allocator = axutil_allocator_init(NULL);
- const axutil_env_t *env = axutil_env_create(allocator);
conf = axis2_conf_create(env);
-
- op = axis2_op_create(env);
+ CUT_ASSERT_PTR_NOT_EQUAL(conf, NULL, 1);
conf_ctx = axis2_conf_ctx_create(env, conf);
-
+ CUT_ASSERT_PTR_NOT_EQUAL(conf_ctx, NULL, 1);
+
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);
+
op_ctx1 = axis2_op_ctx_create(env, op, svc_ctx1);
+ CUT_ASSERT_PTR_NOT_EQUAL(op_ctx1, NULL, 0);
+
op_ctx2 = axis2_op_ctx_create(env, op, svc_ctx2);
+ CUT_ASSERT_PTR_NOT_EQUAL(op_ctx2, NULL, 0);
op_ctx_map = axis2_conf_ctx_get_op_ctx_map(conf_ctx, env);
-
+ CUT_ASSERT_PTR_NOT_EQUAL(op_ctx_map, NULL, 0);
if (op_ctx_map)
{
axutil_hash_set(op_ctx_map, "op_ctx1", AXIS2_HASH_KEY_STRING, op_ctx1);
@@ -84,7 +97,7 @@ axis2_test_conf_ctx_init(
}
svc_ctx_map = axis2_conf_ctx_get_svc_ctx_map(conf_ctx, env);
-
+ CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx_map, NULL, 0);
if (svc_ctx_map)
{
axutil_hash_set(svc_ctx_map, "svc_ctx1", AXIS2_HASH_KEY_STRING,
@@ -94,6 +107,7 @@ axis2_test_conf_ctx_init(
}
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);
if (svc_grp_ctx_map)
{
@@ -104,13 +118,14 @@ axis2_test_conf_ctx_init(
}
status = axis2_conf_ctx_init(conf_ctx, env, conf);
-
- if (status != AXIS2_SUCCESS)
- {
- printf("ERROR %d\n", status);
- }
- else
- printf("SUCCESS\n");
+ CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0);
+ printf("Error code : %d\n", 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);
}
@@ -119,6 +134,12 @@ int
main(
)
{
- axis2_test_conf_ctx_init();
+ 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;
}