You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2005/12/13 05:17:20 UTC
svn commit: r356465 - in /webservices/axis2/trunk/c: ./ include/
modules/core/description/src/ modules/core/engine/src/
modules/core/phaseresolver/src/ modules/util/src/ test/unit/
test/unit/core/ test/unit/core/phaseresolver/
Author: damitha
Date: Mon Dec 12 20:16:43 2005
New Revision: 356465
URL: http://svn.apache.org/viewcvs?rev=356465&view=rev
Log:
Added a unit test to phase resolver. Fixed bugs during the course
Modified:
webservices/axis2/trunk/c/configure.ac
webservices/axis2/trunk/c/include/axis2_disp.h
webservices/axis2/trunk/c/include/axis2_flow.h
webservices/axis2/trunk/c/include/axis2_handler_desc.h
webservices/axis2/trunk/c/modules/core/description/src/Makefile.am
webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c
webservices/axis2/trunk/c/modules/core/description/src/operation.c
webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am
webservices/axis2/trunk/c/modules/core/engine/src/disp.c
webservices/axis2/trunk/c/modules/core/engine/src/msg_recv.c
webservices/axis2/trunk/c/modules/core/engine/src/phase.c
webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_holder.c
webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c
webservices/axis2/trunk/c/modules/util/src/Makefile.am
webservices/axis2/trunk/c/modules/util/src/axis2_string.h
webservices/axis2/trunk/c/modules/util/src/string.c
webservices/axis2/trunk/c/test/unit/core/Makefile.am
webservices/axis2/trunk/c/test/unit/core/phaseresolver/Makefile.am
webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.c
webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.h
webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.c
webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.h
webservices/axis2/trunk/c/test/unit/main.c
Modified: webservices/axis2/trunk/c/configure.ac
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/configure.ac?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/configure.ac (original)
+++ webservices/axis2/trunk/c/configure.ac Mon Dec 12 20:16:43 2005
@@ -131,6 +131,7 @@
test/unit/core/engine/Makefile \
test/unit/core/context/Makefile \
test/unit/core/phaseresolver/Makefile \
+ test/unit/core/deployment/Makefile \
test/unit/util/Makefile \
test/unit/xml/Makefile \
test/unit/xml/om/Makefile
Modified: webservices/axis2/trunk/c/include/axis2_disp.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_disp.h?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_disp.h (original)
+++ webservices/axis2/trunk/c/include/axis2_disp.h Mon Dec 12 20:16:43 2005
@@ -31,7 +31,8 @@
extern "C"
{
#endif
-
+ struct axis2_operation;
+ struct axis2_svc;
struct axis2_disp;
struct axis2_disp_ops;
@@ -69,9 +70,9 @@
* @param msg_ctx
* @return
*/
- axis2_operation_t* (AXIS2_CALL *find_operation)(axis2_msg_ctx_t *msg_ctx,
+ struct axis2_operation *(AXIS2_CALL *find_operation)(axis2_msg_ctx_t *msg_ctx,
axis2_env_t **env,
- axis2_svc_t *svc);
+ struct axis2_svc *svc);
} axis2_disp_ops_t;
Modified: webservices/axis2/trunk/c/include/axis2_flow.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_flow.h?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_flow.h (original)
+++ webservices/axis2/trunk/c/include/axis2_flow.h Mon Dec 12 20:16:43 2005
@@ -103,7 +103,7 @@
#define AXIS2_FLOW_FREE(flow, env) ((flow->ops)->free (flow, env))
-#define AXIS2_FLOW_ADD_HANDLER(flow, env, param) \
+#define AXIS2_FLOW_ADD_HANDLER(flow, env, handler) \
((flow->ops)->add_handler (flow, env, handler))
#define AXIS2_FLOW_GET_HANDLER(flow, env, index) \
Modified: webservices/axis2/trunk/c/include/axis2_handler_desc.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_handler_desc.h?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_handler_desc.h (original)
+++ webservices/axis2/trunk/c/include/axis2_handler_desc.h Mon Dec 12 20:16:43 2005
@@ -60,7 +60,7 @@
axis2_env_t **env, axis2_char_t *name);
axis2_status_t (AXIS2_CALL *add_param) (struct axis2_handler_desc *handler_desc,
axis2_env_t **env, axis2_param_t * param);
- axis2_hash_t* (AXIS2_CALL *get_params) (struct axis2_handler_desc *handler_desc,
+ axis2_array_list_t* (AXIS2_CALL *get_params) (struct axis2_handler_desc *handler_desc,
axis2_env_t **env);
/**
@@ -100,7 +100,7 @@
* creates handler_desc struct
* @param qname qname, can be NULL
*/
-AXIS2_DECLARE(axis2_handler_desc_t*) axis2_handler_desc_create(axis2_env_t **env, axis2_qname_t *qname);
+AXIS2_DECLARE(axis2_handler_desc_t*) axis2_handler_desc_create_with_qname(axis2_env_t **env, axis2_qname_t *qname);
#define AXIS2_HANDLER_DESC_GET_HANDLER(handler_desc, env) ((handler_desc)->ops->get_handler(handler_desc, env))
#define AXIS2_HANDLER_DESC_SET_HANDLER(handler_desc, env, handler) ((handler_desc)->ops->set_handler(handler_desc, env, handler))
Modified: webservices/axis2/trunk/c/modules/core/description/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/Makefile.am?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/description/src/Makefile.am Mon Dec 12 20:16:43 2005
@@ -4,6 +4,7 @@
operation.c \
svc.c \
module.c \
+ module_desc.c \
param.c \
svc_grp.c \
phase_rule.c \
Modified: webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c Mon Dec 12 20:16:43 2005
@@ -52,7 +52,7 @@
axis2_env_t **env, axis2_char_t *name);
axis2_status_t AXIS2_CALL axis2_handler_desc_add_param(struct axis2_handler_desc *handler_desc,
axis2_env_t **env, axis2_param_t * param);
-axis2_hash_t* AXIS2_CALL axis2_handler_desc_get_params(struct axis2_handler_desc *handler_desc,
+axis2_array_list_t* AXIS2_CALL axis2_handler_desc_get_params(struct axis2_handler_desc *handler_desc,
axis2_env_t **env);
axis2_bool_t AXIS2_CALL axis2_handler_desc_is_param_locked(struct axis2_handler_desc *handler_desc,
axis2_env_t **env, axis2_char_t * param_name);
@@ -72,7 +72,7 @@
axis2_status_t AXIS2_CALL axis2_handler_desc_free (struct axis2_handler_desc *handler_desc,
axis2_env_t **env);
-axis2_handler_desc_t* AXIS2_CALL axis2_handler_desc_create(axis2_env_t **env, axis2_qname_t *qname)
+axis2_handler_desc_t* AXIS2_CALL axis2_handler_desc_create_with_qname(axis2_env_t **env, axis2_qname_t *qname)
{
axis2_handler_desc_impl_t *handler_desc_impl = NULL;
@@ -224,7 +224,7 @@
return AXIS2_PARAM_CONTAINER_ADD_PARAM(handler_desc_impl->param_container, env, param);
}
-axis2_hash_t* AXIS2_CALL axis2_handler_desc_get_params(struct axis2_handler_desc *handler_desc,
+axis2_array_list_t* AXIS2_CALL axis2_handler_desc_get_params(struct axis2_handler_desc *handler_desc,
axis2_env_t **env)
{
axis2_handler_desc_impl_t *handler_desc_impl = NULL;
Modified: webservices/axis2/trunk/c/modules/core/description/src/operation.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/operation.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/operation.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/src/operation.c Mon Dec 12 20:16:43 2005
@@ -1044,6 +1044,7 @@
axis2_env_t **env)
{
AXIS2_FUNC_PARAM_CHECK(operation, env, NULL);
+
return AXIS2_INTF_TO_IMPL(operation)->remaining_phases_inflow;
}
Modified: webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am Mon Dec 12 20:16:43 2005
@@ -1,7 +1,17 @@
lib_LTLIBRARIES = libaxis2_engine.la
AM_CPPFLAGS = $(CPPFLAGS)
-libaxis2_engine_la_SOURCES = handler.c msg_recv.c engine_config.c phase.c disp_checker.c event.c \
- addr_disp.c req_uri_disp.c soap_action_disp.c soap_body_disp.c
+
+libaxis2_engine_la_SOURCES = handler.c \
+ msg_recv.c \
+ engine_config.c \
+ phase.c \
+ disp_checker.c \
+ event.c \
+ addr_disp.c \
+ req_uri_disp.c \
+ disp.c \
+ soap_action_disp.c \
+ soap_body_disp.c
libaxis2_engine_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include \
Modified: webservices/axis2/trunk/c/modules/core/engine/src/disp.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/disp.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/disp.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/src/disp.c Mon Dec 12 20:16:43 2005
@@ -48,9 +48,9 @@
axis2_env_t **env);
axis2_svc_t* AXIS2_CALL axis2_disp_find_svc(axis2_msg_ctx_t * msg_ctx,
axis2_env_t **env);
-axis2_operation* AXIS2_CALL axis2_disp_find_operation(axis2_msg_ctx_t * msg_ctx,
+struct axis2_operation* AXIS2_CALL axis2_disp_find_operation(axis2_msg_ctx_t * msg_ctx,
axis2_env_t **env,
- axis2_svc_t *svc);
+ struct axis2_svc *svc);
axis2_disp_t* AXIS2_CALL axis2_disp_create(axis2_env_t **env, axis2_qname_t *qname)
@@ -198,7 +198,7 @@
axis_service = AXIS2_MSG_CTX_GET_SVC(msg_ctx, env);
if (axis_service)
{
- operation = AXIS2_MSG_CTX_GET_OPERATION(msg_ctx, env, axis_service);
+ operation = AXIS2_MSG_CTX_GET_OPERATION(msg_ctx, env);
if (operation)
{
AXIS2_MSG_CTX_SET_OPERATION(msg_ctx, env, operation);
@@ -267,9 +267,9 @@
* @param msg_ctx
* @return
*/
-axis2_operation* AXIS2_CALL axis2_disp_find_operation(axis2_msg_ctx_t * msg_ctx,
+struct axis2_operation* AXIS2_CALL axis2_disp_find_operation(axis2_msg_ctx_t * msg_ctx,
axis2_env_t **env,
- axis2_svc_t *svc)
+ struct axis2_svc *svc)
{
return NULL;
}
Modified: webservices/axis2/trunk/c/modules/core/engine/src/msg_recv.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/msg_recv.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/msg_recv.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/src/msg_recv.c Mon Dec 12 20:16:43 2005
@@ -43,22 +43,29 @@
axis2_msg_recv_t * AXIS2_CALL
axis2_msg_recv_create (axis2_env_t **env)
{
+ axis2_msg_recv_impl_t *msg_recv_impl = NULL;
+
AXIS2_ENV_CHECK(env, NULL);
- axis2_msg_recv_impl_t *msg_recv_impl =
- (axis2_msg_recv_impl_t *) AXIS2_MALLOC ((*env)->allocator
+ msg_recv_impl = (axis2_msg_recv_impl_t *) AXIS2_MALLOC ((*env)->allocator
, sizeof (axis2_msg_recv_impl_t));
if(NULL == msg_recv_impl)
+ {
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+ return NULL;
+ }
+
+ msg_recv_impl->msg_recv.ops = NULL;
msg_recv_impl->msg_recv.ops = (axis2_msg_recv_ops_t *) AXIS2_MALLOC(
(*env)->allocator, sizeof(axis2_msg_recv_ops_t));
if(NULL == msg_recv_impl->msg_recv.ops)
{
- AXIS2_FREE((*env)->allocator, msg_recv_impl);
+ axis2_msg_recv_free(&(msg_recv_impl->msg_recv), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+ return NULL;
}
msg_recv_impl->msg_recv.ops->free = axis2_msg_recv_free;
Modified: webservices/axis2/trunk/c/modules/core/engine/src/phase.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/phase.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/phase.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/src/phase.c Mon Dec 12 20:16:43 2005
@@ -475,7 +475,8 @@
{
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
return AXIS2_FAILURE;
- }
+ }
+
return axis2_phase_insert_handler_desc(phase, env, handler_desc);
}
}
Modified: webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_holder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_holder.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_holder.c (original)
+++ webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_holder.c Mon Dec 12 20:16:43 2005
@@ -63,36 +63,42 @@
axis2_phase_holder_t * AXIS2_CALL
axis2_phase_holder_create (axis2_env_t **env)
{
+ axis2_phase_holder_impl_t *phase_holder_impl = NULL;
+
AXIS2_ENV_CHECK(env, NULL);
- axis2_phase_holder_impl_t *phase_holder_impl =
- (axis2_phase_holder_impl_t *) AXIS2_MALLOC((*env)->allocator,
- sizeof(axis2_phase_holder_impl_t));
-
+ phase_holder_impl = (axis2_phase_holder_impl_t *) AXIS2_MALLOC((*env)->
+ allocator, sizeof(axis2_phase_holder_impl_t));
if(NULL == phase_holder_impl)
+ {
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+ return NULL;
+ }
phase_holder_impl->phase_list = NULL;
+ phase_holder_impl->phase_holder.ops = NULL;
phase_holder_impl->phase_holder.ops =
AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_phase_holder_ops_t));
if(NULL == phase_holder_impl->phase_holder.ops)
{
- axis2_phase_holder_free(&(phase_holder_impl->
- phase_holder), env);
+ axis2_phase_holder_free(&(phase_holder_impl->phase_holder), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+ return NULL;
}
- phase_holder_impl->phase_holder.ops->free =
- axis2_phase_holder_free;
+ phase_holder_impl->phase_holder.ops->free = axis2_phase_holder_free;
phase_holder_impl->phase_holder.ops->is_phase_exist =
axis2_phase_holder_is_phase_exist;
+
phase_holder_impl->phase_holder.ops->add_handler =
axis2_phase_holder_add_handler;
+
phase_holder_impl->phase_holder.ops->get_phase =
axis2_phase_holder_get_phase;
+
phase_holder_impl->phase_holder.ops->build_transport_handler_chain =
axis2_phase_holder_build_transport_handler_chain;
@@ -102,13 +108,15 @@
axis2_phase_holder_t * AXIS2_CALL
axis2_phase_holder_create_with_phases (axis2_env_t **env, axis2_array_list_t *phases)
{
+ axis2_phase_holder_impl_t *phase_holder_impl = NULL;
+
AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK((*env)->error, phases, NULL);
- axis2_phase_holder_impl_t *phase_holder_impl = (axis2_phase_holder_impl_t *)
- axis2_phase_holder_create(env);
- AXIS2_ARRAY_LIST_FREE(phase_holder_impl->phase_list, env);
+ phase_holder_impl = (axis2_phase_holder_impl_t *)axis2_phase_holder_create(env);
+
phase_holder_impl->phase_list = phases;
+
return &(phase_holder_impl->phase_holder);
}
@@ -118,20 +126,27 @@
axis2_phase_holder_free (axis2_phase_holder_t *phase_holder,
axis2_env_t **env)
{
- axis2_phase_holder_impl_t *phase_holder_impl =
- AXIS2_INTF_TO_IMPL(phase_holder);
+ axis2_phase_holder_impl_t *phase_holder_impl = NULL;
AXIS2_FUNC_PARAM_CHECK(phase_holder, env, AXIS2_FAILURE);
+ phase_holder_impl = AXIS2_INTF_TO_IMPL(phase_holder);
+
if(NULL != phase_holder->ops)
+ {
AXIS2_FREE((*env)->allocator, phase_holder->ops);
+ phase_holder->ops = NULL;
+ }
if(NULL != phase_holder_impl->phase_list)
{
AXIS2_ARRAY_LIST_FREE(phase_holder_impl->phase_list, env);
+ phase_holder_impl->phase_list = NULL;
}
- AXIS2_FREE((*env)->allocator, phase_holder_impl);
+ if(phase_holder_impl)
+ AXIS2_FREE((*env)->allocator, phase_holder_impl);
+ phase_holder_impl = NULL;
return AXIS2_SUCCESS;
}
@@ -150,7 +165,7 @@
int size = 0;
int i = 0;
struct axis2_phase *phase = NULL;
-
+
AXIS2_FUNC_PARAM_CHECK(phase_holder, env, AXIS2_FALSE);
AXIS2_PARAM_CHECK((*env)->error, phase_name, AXIS2_FALSE);
@@ -162,6 +177,7 @@
{
phase = (struct axis2_phase *) AXIS2_ARRAY_LIST_GET(phase_holder_impl->
phase_list, env, i);
+
if (0 == AXIS2_STRCMP(AXIS2_PHASE_GET_NAME(phase, env), phase_name))
{
return AXIS2_TRUE;
@@ -225,7 +241,8 @@
size = AXIS2_ARRAY_LIST_SIZE(phase_holder_impl->phase_list, env);
- for (i = 0; i < size; i++) {
+ for (i = 0; i < size; i++)
+ {
phase = (struct axis2_phase *) AXIS2_ARRAY_LIST_GET(phase_holder_impl->
phase_list, env, i);
if(0 == AXIS2_STRCMP(AXIS2_PHASE_GET_NAME(phase, env), phase_name))
Modified: webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c (original)
+++ webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c Mon Dec 12 20:16:43 2005
@@ -1193,20 +1193,23 @@
{
axis2_phase_resolver_impl_t *resolver_impl = NULL;
int type = 0;
- int j = 0;
axis2_status_t status = AXIS2_FALSE;
resolver_impl = AXIS2_INTF_TO_IMPL(phase_resolver);
-
+
for (type = 1; type < 5; type++)
{
struct axis2_flow *flow = NULL;
+ axis2_array_list_t *phases = NULL;
switch (type) {
case AXIS2_INFLOW:
{
+ phases = AXIS2_OPERATION_GET_REMAINING_PHASES_INFLOW(axis_operation, env);
+
resolver_impl->phase_holder = axis2_phase_holder_create_with_phases(env,
- AXIS2_OPERATION_GET_REMAINING_PHASES_INFLOW(axis_operation, env));
+ phases);
+
break;
}
case AXIS2_OUTFLOW:
@@ -1229,7 +1232,8 @@
}
}
- switch (type) {
+ switch (type)
+ {
case AXIS2_INFLOW:
{
flow = AXIS2_MODULE_DESC_GET_INFLOW(module_desc, env);
@@ -1251,7 +1255,10 @@
break;
}
}
- if (NULL != flow) {
+ if (NULL != flow)
+ {
+ int j = 0;
+
for (j = 0; j < AXIS2_FLOW_GET_HANDLER_COUNT(flow, env); j++)
{
struct axis2_handler_desc *metadata = NULL;
@@ -1260,6 +1267,7 @@
metadata = AXIS2_FLOW_GET_HANDLER(flow, env, j);
phase_name = AXIS2_PHASE_RULE_GET_NAME(
AXIS2_HANDLER_DESC_GET_RULES(metadata, env), env);
+
if ((0 != AXIS2_STRCMP(AXIS2_PHASE_TRANSPORTIN, phase_name)) &&
(0 != AXIS2_STRCMP(AXIS2_PHASE_DISPATCH, phase_name)) &&
(0 != AXIS2_STRCMP(AXIS2_PHASE_POST_DISPATCH, phase_name)) &&
@@ -1272,6 +1280,7 @@
{
AXIS2_ERROR_SET((*env)->error,
SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE, AXIS2_FAILURE);
+ return NULL;
}
}
Modified: webservices/axis2/trunk/c/modules/util/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/Makefile.am?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/util/src/Makefile.am Mon Dec 12 20:16:43 2005
@@ -10,7 +10,8 @@
file_diff.c \
qname.c \
array_list.c \
- linked_list.c
+ linked_list.c \
+ utils.c
libaxis2_util_la_LIBADD = $(LDFLAGS)
INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include \
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_string.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_string.h?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_string.h (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_string.h Mon Dec 12 20:16:43 2005
@@ -38,8 +38,12 @@
AXIS2_DECLARE(int)
axis2_strcmp (const axis2_char_t * s1, const axis2_char_t * s2);
+ AXIS2_DECLARE(int)
+ axis2_strlen(const axis2_char_t *s);
+
#define AXIS2_STRDUP(pts, env) axis2_strdup(pts, env)
#define AXIS2_STRCMP(s1, s2) axis2_strcmp(s1, s2)
+#define AXIS2_STRLEN(s) axis2_strlen(s)
/** @} */
Modified: webservices/axis2/trunk/c/modules/util/src/string.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/string.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/string.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/string.c Mon Dec 12 20:16:43 2005
@@ -51,3 +51,11 @@
return -1;
}
+AXIS2_DECLARE(int)
+axis2_strlen(const axis2_char_t *s)
+{
+ if(s)
+ return strlen(s);
+ else
+ return -1;
+}
Modified: webservices/axis2/trunk/c/test/unit/core/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/core/Makefile.am?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/core/Makefile.am (original)
+++ webservices/axis2/trunk/c/test/unit/core/Makefile.am Mon Dec 12 20:16:43 2005
@@ -1 +1 @@
-SUBDIRS = context description engine phaseresolver
+SUBDIRS = context description engine phaseresolver deployment
Modified: webservices/axis2/trunk/c/test/unit/core/phaseresolver/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/core/phaseresolver/Makefile.am?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/core/phaseresolver/Makefile.am (original)
+++ webservices/axis2/trunk/c/test/unit/core/phaseresolver/Makefile.am Mon Dec 12 20:16:43 2005
@@ -2,11 +2,16 @@
prglibdir=$(prefix)/lib/unit_test
prglib_LTLIBRARIES = libtest_phaseresolver.la
AM_CPPFLAGS = $(CPPFLAGS)
-libtest_phaseresolver_la_SOURCES = phaseresolver_test.c
+libtest_phaseresolver_la_SOURCES = phaseresolver_test.c \
+ test_resolver.c
+
include_HEADERS=$(top_builddir)/test/unit/core/phaseresolver/*.h
INCLUDES = -I$(top_builddir)/include \
-I$(top_builddir)/modules/util/src \
+ -I$(top_builddir)/modules/core/description/src \
+ -I$(top_builddir)/modules/core/transport \
+ -I$(top_builddir)/modules/wsdl/src \
-I${CUTEST_HOME}/include
prgbin_PROGRAMS = phaseresolver_test
Modified: webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.c (original)
+++ webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.c Mon Dec 12 20:16:43 2005
@@ -4,9 +4,10 @@
#include <axis2_allocator.h>
#include <axis2_env.h>
-CuSuite* axis2_phaseresolverGetSuite() {
+CuSuite* axis2_phaseresolverGetSuite()
+{
CuSuite* suite = CuSuiteNew();
- /*SUITE_ADD_TEST(suite, Testaxis2_stream_ops_read);*/
+ SUITE_ADD_TEST(suite, Testaxis2_phase_resolver_engage_module_to_operation);
return suite;
}
Modified: webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.h?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.h (original)
+++ webservices/axis2/trunk/c/test/unit/core/phaseresolver/phaseresolver_test.h Mon Dec 12 20:16:43 2005
@@ -2,6 +2,7 @@
#define PHASERESOLVER_TEST_H
#include <CuTest.h>
+#include "test_resolver.h"
CuSuite* axis2_phaseresolverGetSuite();
Modified: webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.c (original)
+++ webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.c Mon Dec 12 20:16:43 2005
@@ -1,50 +1,82 @@
#include "test_resolver.h"
+void add_handlers_to_flow(struct axis2_flow *flow, axis2_env_t **env);
+axis2_array_list_t *get_operation_inphases(axis2_env_t **env);
+
void Testaxis2_phase_resolver_engage_module_to_operation(CuTest *tc)
{
struct axis2_phase_resolver *resolver = NULL;
axis2_array_list_t *operation_inphases = NULL;
- struct axis2_module_desc module_desc = NULL;
+ struct axis2_module_desc *module_desc = NULL;
struct axis2_flow *flow = NULL;
+ axis2_status_t expected = AXIS2_SUCCESS;
+ axis2_status_t actual = AXIS2_FAILURE;
axis2_allocator_t *allocator = axis2_allocator_init (NULL);
- axis2_env_t *environment = axis2_env_create (allocator);
+ axis2_env_t *env = axis2_env_create (allocator);
- struct axis2_operation *optr = axis2_operation_create(env);
- operation_inphases = get_operation_inphases(env);
- AXIS2_OPERATION_SET_REMAINING_PHASES_INFLOW(optr, env, operation_inphases);
-
- flow = axis2_flow_create(env);
- add_handlers_to_flow(flow, env);
- module_desc = axis2_module_desc_create(env);
- AXIS2_MODULE_DESC_SET_INFLOW(module_desc, env, flow);
- resolver = axis2_phase_resolver_create(env);
+ struct axis2_operation *optr = axis2_operation_create(&env);
+ operation_inphases = get_operation_inphases(&env);
+ AXIS2_OPERATION_SET_REMAINING_PHASES_INFLOW(optr, &env, operation_inphases);
+
+ flow = axis2_flow_create(&env);
+ add_handlers_to_flow(flow, &env);
+ module_desc = axis2_module_desc_create(&env);
+ AXIS2_MODULE_DESC_SET_INFLOW(module_desc, &env, flow);
+ resolver = axis2_phase_resolver_create(&env);
+ actual = AXIS2_PHASE_RESOLVER_ENGAGE_MODULE_TO_OPERATION(resolver, &env, optr,
+ module_desc);
- /*expected = (a *) axis2_hash_get (ht, key1, AXIS2_HASH_KEY_STRING);
- CuAssertStrEquals(tc, expected->value, actual->value);*/
+ CuAssertIntEquals(tc, expected, actual);
}
-void add_handlers_to_flow(struct axis2_flow *flow, env)
+void add_handlers_to_flow(struct axis2_flow *flow, axis2_env_t **env)
{
+ struct axis2_handler_desc *handler_desc = NULL;
struct axis2_handler *handler = NULL;
+ axis2_qname_t *qname = NULL;
+ struct axis2_phase_rule *rule = NULL;
- handler = axis2_handler_create_with_name(env, "handler1");
- AXIS2_FLOW_ADD_HANDLER(flow, env, handler);
-
- handler = axis2_handler_create_with_name(env, "handler2");
- AXIS2_FLOW_ADD_HANDLER(flow, env, handler);
-
- handler = axis2_handler_create_with_name(env, "handler3");
- AXIS2_FLOW_ADD_HANDLER(flow, env, handler);
+ rule = axis2_phase_rule_create(env, AXIS2_PHASE_POLICY_DETERMINATION);
+ axis2_phase_rule_set_before(rule, env, "before");
+ axis2_phase_rule_set_after(rule, env, "after");
+ qname = axis2_qname_create(env, "handler1", NULL, NULL);
+ handler_desc = axis2_handler_desc_create_with_qname(env, qname);
+ AXIS2_HANDLER_DESC_SET_RULES(handler_desc, env, rule);
+ handler = axis2_handler_create(env);
+ AXIS2_HANDLER_INIT(handler, env, handler_desc);
+ AXIS2_HANDLER_DESC_SET_HANDLER(handler_desc, env, handler);
+ AXIS2_FLOW_ADD_HANDLER(flow, env, handler_desc);
+
+ rule = axis2_phase_rule_create(env, AXIS2_PHASE_POLICY_DETERMINATION);
+ axis2_phase_rule_set_before(rule, env, "before");
+ axis2_phase_rule_set_after(rule, env, "after");
+ qname = axis2_qname_create(env, "handler2", NULL, NULL);
+ handler_desc = axis2_handler_desc_create_with_qname(env, qname);
+ AXIS2_HANDLER_DESC_SET_RULES(handler_desc, env, rule);
+ handler = axis2_handler_create(env);
+ AXIS2_HANDLER_INIT(handler, env, handler_desc);
+ AXIS2_HANDLER_DESC_SET_HANDLER(handler_desc, env, handler);
+ AXIS2_FLOW_ADD_HANDLER(flow, env, handler_desc);
+
+ rule = axis2_phase_rule_create(env, AXIS2_PHASE_POLICY_DETERMINATION);
+ axis2_phase_rule_set_before(rule, env, "before");
+ axis2_phase_rule_set_after(rule, env, "after");
+ qname = axis2_qname_create(env, "handler3", NULL, NULL);
+ handler_desc = axis2_handler_desc_create_with_qname(env, qname);
+ AXIS2_HANDLER_DESC_SET_RULES(handler_desc, env, rule);
+ handler = axis2_handler_create(env);
+ AXIS2_HANDLER_INIT(handler, env, handler_desc);
+ AXIS2_HANDLER_DESC_SET_HANDLER(handler_desc, env, handler);
+ AXIS2_FLOW_ADD_HANDLER(flow, env, handler_desc);
}
/** helper method. This is the requirement method from phases_info's
* axis2_get_operation_inphases method
*/
-axis2_array_list get_operation_inphases(axis2_env_t **env)
+axis2_array_list_t *get_operation_inphases(axis2_env_t **env)
{
- struct axis2_phase *phase = NULL;
- int i = 0;
+ struct axis2_phase *phase = NULL;
axis2_array_list_t *operation_inphases = NULL;
operation_inphases = axis2_array_list_create(env, 0);
@@ -61,7 +93,7 @@
phase = axis2_phase_create(env, AXIS2_PHASE_DISPATCH);
AXIS2_ARRAY_LIST_ADD(operation_inphases, env, phase);
- phase = axis2_phase_create(env, AXIS2_PHASE_POLICY_DETERMINATIONzzzz);
+ phase = axis2_phase_create(env, AXIS2_PHASE_POLICY_DETERMINATION);
AXIS2_ARRAY_LIST_ADD(operation_inphases, env, phase);
return operation_inphases;
Modified: webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.h?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.h (original)
+++ webservices/axis2/trunk/c/test/unit/core/phaseresolver/test_resolver.h Mon Dec 12 20:16:43 2005
@@ -8,7 +8,15 @@
#include <axis2_env.h>
#include <axis2_hash.h>
#include <axis2_string.h>
-#include <axis2_phaseresolver.h>
+#include <axis2_phase_resolver.h>
+#include <axis2_module_desc.h>
+#include <axis2_operation.h>
+#include <axis2_flow.h>
+
+struct axis2_flow;
+struct axis2_operation;
+struct axis2_module_desc;
+
void Testaxis2_phase_resolver_engage_module_to_operation(CuTest *tc);
Modified: webservices/axis2/trunk/c/test/unit/main.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/main.c?rev=356465&r1=356464&r2=356465&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/main.c (original)
+++ webservices/axis2/trunk/c/test/unit/main.c Mon Dec 12 20:16:43 2005
@@ -7,8 +7,8 @@
CuSuite* suite = CuSuiteNew();
CuSuiteAddSuite(suite, axis2_utilGetSuite());
- /*CuSuiteAddSuite(suite, axis2_commonGetSuite());*/
CuSuiteAddSuite(suite, axis2_omGetSuite());
+ CuSuiteAddSuite(suite, axis2_phaseresolverGetSuite());
CuSuiteRun(suite);
CuSuiteSummary(suite, output);