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 du...@apache.org on 2008/02/19 12:59:45 UTC

svn commit: r629082 - in /webservices/axis2/trunk/c/util/test/uri: build.sh uri_test.c

Author: dushshantha
Date: Tue Feb 19 03:59:44 2008
New Revision: 629082

URL: http://svn.apache.org/viewvc?rev=629082&view=rev
Log:
applied the patch for AXIS2C-992

Modified:
    webservices/axis2/trunk/c/util/test/uri/build.sh
    webservices/axis2/trunk/c/util/test/uri/uri_test.c

Modified: webservices/axis2/trunk/c/util/test/uri/build.sh
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/test/uri/build.sh?rev=629082&r1=629081&r2=629082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/test/uri/build.sh (original)
+++ webservices/axis2/trunk/c/util/test/uri/build.sh Tue Feb 19 03:59:44 2008
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-gcc uri_test.c ../util/create_env.c -g -I$AXIS2C_HOME/include/axis2-1.2 -L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -o uri_test 
+gcc uri_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 uri_test 

Modified: webservices/axis2/trunk/c/util/test/uri/uri_test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/test/uri/uri_test.c?rev=629082&r1=629081&r2=629082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/test/uri/uri_test.c (original)
+++ webservices/axis2/trunk/c/util/test/uri/uri_test.c Tue Feb 19 03:59:44 2008
@@ -1,66 +1,139 @@
 #include <axutil_uri.h>
 #include "../util/create_env.h"
-
-axutil_env_t *env = NULL;
-axutil_uri_t * uri;
-axis2_char_t *uri_str = "http://user:pass@example.com:80/foo?bar#item5";
-axis2_char_t * hostinfo = "http://user:pass@example.com:80";
-axutil_uri_t * base;
-axis2_char_t * uri_str_base = "http://user:pass@example.com:80/foo?bar";
-axis2_char_t * scheme_str = "http";
-unsigned flags;
-axis2_char_t *protocol;
-axis2_char_t *server;
-axis2_port_t port;
-axis2_char_t *path;
-
 /** @brief test uri 
- * create URI and get the values of it's components  
- */
-
-axis2_status_t test_uri()
+ *  * create URI and get the values of it's components  
+ *   */
+axis2_status_t test_uri(axutil_env_t *env)
 {   
-    env = create_environment();
-    uri = (axutil_uri_t *)axutil_uri_create(env);
-    base = (axutil_uri_t *)axutil_uri_create(env);
+    unsigned flags;
+    axis2_char_t *uri_str = "http://user:pass@example.com:80/foo?bar#item5";
+    axis2_char_t * host = "home.netscape.com:443";
+    axis2_char_t * uri_str_base = "http://user:pass@example.com:80/foo?bar";
+    axis2_char_t * scheme_str = "http";
+    axutil_uri_t * base = NULL;
+    axutil_uri_t * hostinfo = NULL;
+    axutil_uri_t * uri = NULL;
+    axutil_uri_t * clone = NULL;
+    axutil_uri_t * rel = NULL;
+    axis2_char_t *protocol = NULL;
+    axis2_char_t *server = NULL;
+    axis2_char_t *path = NULL;
+    axis2_port_t scheme_port;
+    axis2_status_t status = AXIS2_FAILURE;
+    axis2_port_t port;
+
+    hostinfo = axutil_uri_parse_hostinfo(env,host);
+    if(hostinfo)
+    {
+        printf("The host information of uri is %s\n",axutil_uri_to_string(hostinfo,env,0));
+    }
+    else
+    {
+        printf("Test hostinfo faild\n");
+    } 
+    
+    scheme_port = axutil_uri_port_of_scheme(scheme_str); 
+    if(scheme_port)
+    {
+        printf("port of scheme is %d\n", (int)scheme_port);
+    }
+    else
+    {
+        printf("Test port failed\n");
+    }
+    
+    uri = axutil_uri_parse_string(env,uri_str);    
+    if(uri)
+    {
+        printf("The uri is %s\n",axutil_uri_to_string(uri,env,0));
+        axutil_uri_free(uri, env);
+    }
+    else     
+    { 
+         return AXIS2_FAILURE;
+    }
+
     base = axutil_uri_parse_string(env,uri_str_base);
-    axutil_uri_parse_hostinfo(env,hostinfo);
-    axutil_uri_parse_relative(env,base,(char *)uri);
-    axutil_uri_port_of_scheme(scheme_str); 
-    axutil_uri_parse_relative(env,base,(char *)uri);
-    axutil_uri_clone(uri,env);
-    uri = axutil_uri_parse_string(env,uri_str);
-    axutil_uri_resolve_relative(env,base,uri);
-    printf("The uri is %s\n",axutil_uri_to_string(uri,env,flags));
+    if(base)
+    {
+         printf("The base of uri is %s\n",axutil_uri_to_string(base,env,0));
+    }
+    else 
+    {
+       printf("Test base failed\n");
+    }
+
+    clone = axutil_uri_clone(uri,env);
+    if(clone)
+    {
+        printf("The clone of uri is %s\n",axutil_uri_to_string(clone,env,0));
+        axutil_uri_free(clone,env);
+    }
+    else
+    {
+        printf("Test clone failed");
+    }
+    
+    rel = axutil_uri_resolve_relative(env,base,clone);
+    if(rel)
+    {
+        printf("The resolve relative uri is %s\n",axutil_uri_to_string(rel,env,flags));
+    }
+    else
+    {
+        printf("Test resolve relative failed");
+    }
+    
     protocol = axutil_uri_get_protocol(uri,env);
+    if (!protocol)
+    {
+        axutil_uri_free(uri,env);
+        return AXIS2_FAILURE;
+    }
+    
     server = axutil_uri_get_server(uri,env);
+    if (!server)
+    {
+        axutil_uri_free(uri,env);
+        return AXIS2_FAILURE;
+    }
+    
     port = axutil_uri_get_port(uri,env);
-    path = axutil_uri_get_path(uri,env);
-    printf("The protocol is %s\n",protocol);
-    printf("The server is %s \n",server);
-    printf("The port is %d \n",(unsigned short)port);
-    printf("The path is %s\n",path);
-    if(uri)
+    if (!port)
     {
-    printf("The test is SUCCESS\n"); 
+        axutil_uri_free(uri,env);
+        return AXIS2_FAILURE;
     }
-    if(!uri)
+    
+    path = axutil_uri_get_path(uri,env);
+    if (!path)
     {
-    printf("The test is FAIL");
+        axutil_uri_free(uri,env);
+        return AXIS2_FAILURE;
     }
+   
+    printf("The protocol is %s\n",protocol);
+    printf("The server is %s \n",server);
+    printf("The port is %d \n",(unsigned short)port);
+    printf("The path is %s\n",path); 
     axutil_uri_free(uri,env);
     return AXIS2_SUCCESS;
 }
+
 int main()
-{
+{   
     int status = AXIS2_SUCCESS;
+    axutil_env_t *env = NULL;
+    
     env = create_environment();
-    status = test_uri();
+    status = test_uri(env);
+    
     if(status == AXIS2_FAILURE)
     {
-        printf(" test  failed");
+        printf(" Test is 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