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 pi...@apache.org on 2008/03/23 08:44:49 UTC

svn commit: r640170 - /webservices/axis2/trunk/c/util/test/properties/property_test.c

Author: pini
Date: Sun Mar 23 00:44:48 2008
New Revision: 640170

URL: http://svn.apache.org/viewvc?rev=640170&view=rev
Log:
Fixing jira issue 1073

Modified:
    webservices/axis2/trunk/c/util/test/properties/property_test.c

Modified: webservices/axis2/trunk/c/util/test/properties/property_test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/test/properties/property_test.c?rev=640170&r1=640169&r2=640170&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/test/properties/property_test.c (original)
+++ webservices/axis2/trunk/c/util/test/properties/property_test.c Sun Mar 23 00:44:48 2008
@@ -3,92 +3,102 @@
 #include "../util/create_env.h"
 #include <axutil_properties.h>
 
-axutil_hash_t* all_properties = NULL;
-axis2_char_t* cur = NULL;
-axis2_char_t* input_filename = "test.doc";
-axutil_env_t *env = NULL;
-axutil_properties_t * properties = NULL;
-axis2_status_t  store_properties ;
-axis2_status_t  load_properties ;
-axis2_char_t * key = "key";
-axis2_char_t * value = "value";
 
 /** @brief test properties
   * read file and give the output
   */
-axis2_status_t test_properties()
+axis2_status_t test_properties(axutil_env_t *env)
 { 
+    axutil_hash_t* all_properties = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+    axis2_char_t* cur = NULL;
+    axis2_char_t* input_filename = "test.doc";
+    axutil_properties_t * properties = NULL;
+    axis2_status_t  store_properties ;
+    axis2_status_t  load_properties ;
+    axis2_char_t * key = "key";
+    axis2_char_t * value = "value";
     FILE *input = fopen("input.doc","rb");
     FILE *output = fopen("output.doc","rb");
     if (!(input && output))
     {
         return AXIS2_FAILURE;
     }
-
-    env = create_environment();
-    if(!env)
-    {
-    printf("Environment is not cteated\n");
-    }
+    
     properties = axutil_properties_create(env);
     if(!properties)
     {
-    printf("Properties are not created\n");
-    }
-    if(properties)
-    {
-    printf("Properties are created\n");
+        printf("Properties are not created\n");
+        axutil_property_free(properties,env);
+        return AXIS2_FAILURE;
     }
+    else
+    printf("The the axutil_properties_create is successfull\n");
+ 
     cur = (axis2_char_t*)axutil_properties_read(input,env);
     if(!cur)
     {
-    printf("Can't read properties\n");
+        printf("Can't read properties\n");
+        axutil_property_free(properties,env);
+        return AXIS2_FAILURE;
     }
-    axutil_properties_read_next(cur);
-    axutil_properties_set_property(properties,env, key, value);
+    else
+    printf("The test axutil_properties_read is successfull\n");
+
+    status = axutil_properties_set_property(properties,env, key, value);
+    if (status == AXIS2_SUCCESS)
+        printf("The test axutil_properties_set_property is successful\n");
+    else
+        printf("The test axutil_properties_set_property failed\n") ;
+
+  
     store_properties = axutil_properties_store(properties,env,output);
     if(!store_properties)
     {
-    printf("Can not store the properties\n");
-    }
-    if(store_properties)
-    {
-    printf("Stored the properties\n");
+        printf("Can not store the properties\n");
+        axutil_property_free(properties,env);
+        return AXIS2_FAILURE;
     }
+    else 
+    printf("The test axutil_properties_store is successfull\n");
+    
     load_properties = axutil_properties_load(properties,env,input_filename);   
     if(!load_properties)
     {
-    printf("Properties not loaded\n");
-    }
-    if(load_properties)
-    {
-    printf("Properties are loaded\n");
+        printf("Properties can't be loaded\n");
+        axutil_property_free(properties,env);
+        return AXIS2_FAILURE;
     }
+    else 
+    printf("The test axutil_properties_load is successfull\n");
+    
     all_properties = axutil_properties_get_all(properties,env);
     if(!all_properties)
     {
-    printf("Can't call properties_get_all\n");
-    }
-    if(all_properties)
-    {
-    printf((char*)cur);
-    printf("The test is success\n");
+        printf("Can't call properties_get_all\n");
+        axutil_property_free(properties,env);
+        return AXIS2_FAILURE;
     }
+    else
+    printf("The test axutil_properties_get_all is successfull\n");
+    
+    axutil_property_free(properties,env);   
+ 
     return AXIS2_SUCCESS;
 }
 
 int main()
 {
+    axutil_env_t *env = NULL;
     int status = AXIS2_SUCCESS;
-
     env = create_environment();
-
-    status = test_properties();
-
+    status = test_properties(env);
+    
     if(status == AXIS2_FAILURE)
     {
         printf(" The test is failed\n");
     }
+    
     axutil_env_free(env);
     return 0;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org