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 se...@apache.org on 2008/02/25 14:17:24 UTC

svn commit: r630837 - in /webservices/axis2/trunk/c/util/test/url: build.sh url_test.c

Author: senaka
Date: Mon Feb 25 05:17:15 2008
New Revision: 630837

URL: http://svn.apache.org/viewvc?rev=630837&view=rev
Log:
Applying patch for JIRA Issue AXIS2C-1002. Thanks Manoj for the patch

Modified:
    webservices/axis2/trunk/c/util/test/url/build.sh
    webservices/axis2/trunk/c/util/test/url/url_test.c

Modified: webservices/axis2/trunk/c/util/test/url/build.sh
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/test/url/build.sh?rev=630837&r1=630836&r2=630837&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/test/url/build.sh (original)
+++ webservices/axis2/trunk/c/util/test/url/build.sh Mon Feb 25 05:17:15 2008
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-gcc url_test.c ../util/create_env.c -g -I$AXIS2C_HOME/include/axis2-1.2 -L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -o url_test 
+gcc url_test.c ../util/create_env.c -g -Werror -I$AXIS2C_HOME/include/axis2-1.3.0 -L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -o url_test -ldl -Wl,--rpath -Wl,$AXIS2C_HOME/lib 

Modified: webservices/axis2/trunk/c/util/test/url/url_test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/test/url/url_test.c?rev=630837&r1=630836&r2=630837&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/test/url/url_test.c (original)
+++ webservices/axis2/trunk/c/util/test/url/url_test.c Mon Feb 25 05:17:15 2008
@@ -1,62 +1,128 @@
 #include <axutil_url.h>
 #include "../util/create_env.h"
 
-axutil_env_t *env = NULL;
-axutil_url_t * url;
-axis2_char_t *url_str = "https://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12386356";
-axis2_char_t *set_protocol = "file";
-axis2_char_t *get_protocol;
-axis2_char_t *set_server = "www.yahoo.com";
-axis2_char_t *get_server;
-axis2_port_t set_port = 80;
-axis2_port_t get_port;
-axis2_char_t *set_path = "/bar/";
-axis2_char_t *get_path;
-
-/** @brief test uri 
+/** @brief test url 
  * create URL and get the values of it's components  
  */
 
-axis2_status_t test_uri()
-{   
-    env = create_environment();
-    url = (axutil_url_t *)axutil_url_create(env,"http","www.google.com",8090,"/foo/");
+axis2_status_t test_url(axutil_env_t *env)
+{
+    axutil_url_t * url;
+    axis2_char_t *url_str = "https://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12386356";
+    axis2_char_t *set_server = "www.yahoo.com";
+    axis2_char_t *set_protocol = "file";
+    axis2_char_t *set_path = "/bar/";
+    axis2_port_t set_port = 80;
+    axis2_char_t *get_protocol;
+    axis2_char_t *get_server;
+    axis2_port_t get_port;
+    axis2_char_t *get_path;
+    axis2_status_t status;
+
     url = axutil_url_parse_string(env,url_str);
-    axutil_url_set_protocol(url,env,set_protocol);
+    if(url)
+    {   
+        printf("The url is created \n");
+    }
+    else
+    {
+         return AXIS2_FAILURE;
+    }
+    
+    status = axutil_url_set_protocol(url,env,set_protocol);
+    
+    if (status == AXIS2_SUCCESS)
+        printf("The test 1 is successful\n");
+    else
+        printf("The test 1 failed\n") ;
+    
+    status = axutil_url_set_server(url,env,set_server);
+    
+    if (status == AXIS2_SUCCESS)
+        printf("The test 2 is successful\n");
+    else
+        printf("The test 2 failed\n") ;
+    
+    status = axutil_url_set_port(url,env,set_port);
+    
+    if (status == AXIS2_SUCCESS)
+        printf("The test 3 is successful\n");
+    else
+        printf("The test 3 failed\n") ;
+    
+    status = axutil_url_set_path(url,env,set_path);
+    
+    if (status == AXIS2_SUCCESS)
+        printf("The test 4 is successful\n");
+    else
+        printf("The test 4 failed\n") ;
+    
     get_protocol = axutil_url_get_protocol(url,env);
-    axutil_url_set_server(url,env,set_server);
-    axutil_url_clone(url,env);
-    axutil_url_to_uri(url,env);
+    
+    if (!get_protocol)
+    {
+        axutil_url_free(url,env);
+        return AXIS2_FAILURE;
+    }
+    else 
+    {
+        printf("The protocol is %s\n",get_protocol);
+    }
+
     get_server = axutil_url_get_server(url,env);
-    axutil_url_set_port(url,env,set_port);
+    
+    if (!get_server)
+    {
+        axutil_url_free(url,env);
+        return AXIS2_FAILURE;
+    }
+    else
+    {
+        printf("The server is %s\n",get_server);
+    }
+        
     get_port = axutil_url_get_port(url,env);
-    axutil_url_set_path(url,env,set_path);
+    
+    if (!get_port)
+    {
+        axutil_url_free(url,env);
+        return AXIS2_FAILURE;
+    }
+    else 
+    {
+        printf("The port is %d\n",get_port);
+    }
+ 
     get_path = axutil_url_get_path(url,env);
-    printf("The protocol is %s\n",get_protocol);
-    printf("The server is %s\n",get_server);
-    printf("The port is %d\n",get_port);
-    printf("The path is %s\n",get_path);
-    if(url)
+    
+    if (!get_path)
     {
-    printf("The test is SUCCESS\n"); 
+        axutil_url_free(url,env);
+        return AXIS2_FAILURE;
     }
-    if(!url)
+    else
     {
-    printf("The test is FAIL");
+        printf("The path is %s\n",get_path);
     }
+
     axutil_url_free(url,env);
     return AXIS2_SUCCESS;
 }
+
 int main()
 {
     int status = AXIS2_SUCCESS;
+    axutil_env_t *env = NULL;
+    
     env = create_environment();
-    status = test_uri();
+    status = test_url(env);
+    
     if(status == AXIS2_FAILURE)
     {
-        printf(" test  failed");
+        printf("Test failed");
     }
     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