You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2006/04/22 17:22:01 UTC

svn commit: r396136 - in /webservices/axis2/trunk/c: modules/core/engine/conf.c test/core/deployment/test_deployment.c

Author: sahan
Date: Sat Apr 22 08:21:59 2006
New Revision: 396136

URL: http://svn.apache.org/viewcvs?rev=396136&view=rev
Log:
Fixed a bug in module engagement. Added a test for versioned module engagement

Modified:
    webservices/axis2/trunk/c/modules/core/engine/conf.c
    webservices/axis2/trunk/c/test/core/deployment/test_deployment.c

Modified: webservices/axis2/trunk/c/modules/core/engine/conf.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/conf.c?rev=396136&r1=396135&r2=396136&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/conf.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/conf.c Sat Apr 22 08:21:59 2006
@@ -974,11 +974,8 @@
     axis2_hash_index_t *index_i = NULL;
     axis2_char_t *svc_name = NULL;
     axis2_char_t *svc_grp_name = NULL;
-    int i = 0;
     int k = 0;
-    int size = 0;
-    axis2_status_t status = AXIS2_FAILURE;
-    
+        
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, svc_grp, AXIS2_FAILURE);
     
@@ -1999,15 +1996,17 @@
     {
         int size = 0;
         int i = 0;
+        axis2_qname_t *module_qname = NULL;
         
         size = AXIS2_ARRAY_LIST_SIZE(config_impl->engaged_modules, env);
+        module_qname = AXIS2_MODULE_DESC_GET_NAME(module_desc, env);
         for(i = 0; i < size; i++)
         {
             axis2_qname_t *qname = NULL;
             
             qname = (axis2_qname_t *) AXIS2_ARRAY_LIST_GET(config_impl->
                 engaged_modules, env, i);
-            if(AXIS2_TRUE == AXIS2_QNAME_EQUALS(module_ref, env, qname))
+            if(AXIS2_TRUE == AXIS2_QNAME_EQUALS(module_qname, env, qname))
             {
                 to_be_engaged = AXIS2_FALSE;
                 /* Instead of throwing the error, we can just log this problem */
@@ -2024,6 +2023,7 @@
     {
         axis2_phase_resolver_t *phase_resolver = NULL;
         axis2_qname_t *module_qref_l = NULL;
+        axis2_qname_t *module_qname = NULL;
 
         phase_resolver = axis2_phase_resolver_create_with_config(env, conf);
         if(!phase_resolver)
@@ -2038,7 +2038,8 @@
         {
             return AXIS2_FAILURE;
         }
-        module_qref_l = AXIS2_QNAME_CLONE(module_ref, env);
+        module_qname = AXIS2_MODULE_DESC_GET_NAME(module_desc, env);
+        module_qref_l = AXIS2_QNAME_CLONE(module_qname, env);
         status = AXIS2_ARRAY_LIST_ADD(config_impl->engaged_modules, env, 
             module_qref_l);
     }

Modified: webservices/axis2/trunk/c/test/core/deployment/test_deployment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/core/deployment/test_deployment.c?rev=396136&r1=396135&r2=396136&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/core/deployment/test_deployment.c (original)
+++ webservices/axis2/trunk/c/test/core/deployment/test_deployment.c Sat Apr 22 08:21:59 2006
@@ -195,6 +195,11 @@
     axis2_module_desc_t *module4 = NULL;
     axis2_module_desc_t *module5 = NULL;
     axis2_module_desc_t *def_mod = NULL;
+    axis2_array_list_t *engaged_modules = NULL;
+    axis2_qname_t *engage_qname = NULL;
+    axis2_bool_t found1 = AXIS2_FALSE;
+    axis2_bool_t found2 = AXIS2_FALSE;
+    axis2_bool_t found3 = AXIS2_FALSE;
 
     printf("******************************************\n");
     printf("testing axis2_default_module_version\n");
@@ -242,7 +247,64 @@
         printf("axis2_default_module_version (test_module) .. FAILED\n");
         return AXIS2_FAILURE;
     } 
+    engage_qname = axis2_qname_create(&env, "module2", NULL, NULL);
+    AXIS2_CONF_ENGAGE_MODULE(axis_conf, &env, engage_qname);
+    AXIS2_QNAME_FREE(engage_qname, &env);
+    engage_qname = NULL;
+    
+    engage_qname = axis2_qname_create(&env, "module1", NULL, NULL);
+    AXIS2_CONF_ENGAGE_MODULE(axis_conf, &env, engage_qname);
+    AXIS2_QNAME_FREE(engage_qname, &env);
+    engage_qname = NULL;
+    
+    AXIS2_CONF_ENGAGE_MODULE_WITH_VERSION(axis_conf, &env, "test_module", "1.92");
+
+    engaged_modules = AXIS2_CONF_GET_ENGAGED_MODULES(axis_conf, &env);
+    
+    if(NULL != engaged_modules)
+    {
+        int list_size = 0;
+        int i = 0;
+        list_size = AXIS2_ARRAY_LIST_SIZE(engaged_modules, &env);
+        for(i = 0; i < list_size; i++)
+        {
+            axis2_qname_t *engaged_mod_qname = NULL;
+            engaged_mod_qname = AXIS2_ARRAY_LIST_GET(engaged_modules, &env, i); 
+            if(0 == AXIS2_STRCMP("module2-0.92", 
+                        AXIS2_QNAME_GET_LOCALPART(engaged_mod_qname, &env)))
+            {
+                found1 = AXIS2_TRUE;
+            }
+            if(0 == AXIS2_STRCMP("module1", 
+                        AXIS2_QNAME_GET_LOCALPART(engaged_mod_qname, &env)))
+            {
+                found2 = AXIS2_TRUE;
+            }
+            if(0 == AXIS2_STRCMP("test_module-1.92", 
+                        AXIS2_QNAME_GET_LOCALPART(engaged_mod_qname, &env)))
+            {
+                found3 = AXIS2_TRUE;
+            }
+            
+        }
+    } 
+    if(AXIS2_FALSE == found1)
+    {
+       printf("axis2_default_module_version (module2 engaging) .. FAILED\n");
+       return AXIS2_FAILURE; 
+    }
+    if(AXIS2_FALSE == found2)
+    {
+       printf("axis2_default_module_version (module1 engaging) .. FAILED\n");
+       return AXIS2_FAILURE; 
+    }
+    if(AXIS2_FALSE == found3)
+    {
+       printf("axis2_default_module_version (test_module engaging) .. FAILED\n");
+       return AXIS2_FAILURE; 
+    }
     printf("axis2_default_module_version  .. SUCCESS\n");
+    AXIS2_CONF_FREE(axis_conf, &env);
     return AXIS2_SUCCESS; 
 }