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 di...@apache.org on 2007/02/05 09:19:28 UTC

svn commit: r503584 - in /webservices/axis2/trunk/c/guththila/tests: test.c test.h test_attribute.c

Author: dinesh
Date: Mon Feb  5 00:19:27 2007
New Revision: 503584

URL: http://svn.apache.org/viewvc?view=rev&rev=503584
Log:
guththila unit tests

Modified:
    webservices/axis2/trunk/c/guththila/tests/test.c
    webservices/axis2/trunk/c/guththila/tests/test.h
    webservices/axis2/trunk/c/guththila/tests/test_attribute.c

Modified: webservices/axis2/trunk/c/guththila/tests/test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/guththila/tests/test.c?view=diff&rev=503584&r1=503583&r2=503584
==============================================================================
--- webservices/axis2/trunk/c/guththila/tests/test.c (original)
+++ webservices/axis2/trunk/c/guththila/tests/test.c Mon Feb  5 00:19:27 2007
@@ -8,21 +8,21 @@
 setup (void)
 {
 allocator = axis2_allocator_init(NULL);
-environment = axis2_env_create(allocator);
+env = axis2_env_create(allocator);
 }
 
 void
 teardown (void)
 {
- guththila_reader_free(environment, red);
- guththila_free(environment, parser);
- axis2_env_free(environment);
+ guththila_reader_free(env, red);
+ guththila_free(env, parser);
+ axis2_env_free(env);
 }
 
 START_TEST (test_guththila)
 {
-	red = guththila_reader_create_for_file(environment, "resources/om/axis.xml");
-    parser = guththila_create(environment, red);
+	red = guththila_reader_create_for_file(env, "resources/om/axis.xml");
+    parser = guththila_create(env, red);
 	fail_if (red == NULL, "guththila reader failed");
 	fail_if (parser == NULL, "guththila parser failed");
 }
@@ -32,30 +32,30 @@
 {
 	int c = 0;
 	char *p;
-	red = guththila_reader_create_for_file(environment, "resources/om/axis.xml");
-    parser = guththila_create(environment, red);
-	guththila_read (environment, parser);
-	c = guththila_next (environment, parser);
+	red = guththila_reader_create_for_file(env, "resources/om/axis.xml");
+    parser = guththila_create(env, red);
+	guththila_read (env, parser);
+	c = guththila_next (env, parser);
 
     while ((c != GUTHTHILA_START_ELEMENT))
-		c = guththila_next (environment, parser);
-	p = guththila_get_name(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_name(env, parser);
 	fail_unless ((c == GUTHTHILA_START_ELEMENT), "no start element found");
 	fail_if ((p == NULL), "no name found");
 	fail_unless (!strcmp (p, "root"), "root element differed");
 	c = 0;
 
     while ((c != GUTHTHILA_START_ELEMENT))
-		c = guththila_next (environment, parser);
-	p = guththila_get_name(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_name(env, parser);
 	fail_unless ((c == GUTHTHILA_START_ELEMENT), "no start element found");
 	fail_if ((p == NULL), "no name found");
 	fail_unless (!strcmp (p, "a"), "a element differed");
 
 	c = 0;
     while ((c != GUTHTHILA_START_ELEMENT))
-		c = guththila_next (environment, parser);
-	p = guththila_get_name(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_name(env, parser);
 	fail_unless (!strcmp (p, "b"), "b element differed");
 }
 END_TEST
@@ -64,14 +64,14 @@
 {
 	int c = 0;
 	char *p;
-	red = guththila_reader_create_for_file(environment, "resources/om/axis.xml");
-    parser = guththila_create(environment, red);
-	guththila_read (environment, parser);
-	c = guththila_next (environment, parser);
+	red = guththila_reader_create_for_file(env, "resources/om/axis.xml");
+    parser = guththila_create(env, red);
+	guththila_read (env, parser);
+	c = guththila_next (env, parser);
 
     while ((c != GUTHTHILA_EMPTY_ELEMENT))
-		c = guththila_next (environment, parser);
-	p = guththila_get_name(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_name(env, parser);
 	fail_unless ((c == GUTHTHILA_EMPTY_ELEMENT), "no empty element found");
 	fail_if ((p == NULL), "no name found");
 	fail_unless (!strcmp (p, "a.1"), "a.1 element differed");
@@ -79,20 +79,20 @@
 	c = 0;
 
     while ((c != GUTHTHILA_EMPTY_ELEMENT))
-		c = guththila_next (environment, parser);
-	p = guththila_get_name(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_name(env, parser);
 	fail_unless ((c == GUTHTHILA_EMPTY_ELEMENT), "no empty element found");
 	fail_if ((p == NULL), "no name found");
 	fail_unless (!strcmp (p, "a.2"), "a.2 element differed");
 
 	c = 0;
     while ((c != GUTHTHILA_START_ELEMENT))
-		c = guththila_next (environment, parser);
+		c = guththila_next (env, parser);
 
 	c = 0;
     while ((c != GUTHTHILA_EMPTY_ELEMENT))
-		c = guththila_next (environment, parser);
-	p = guththila_get_name(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_name(env, parser);
 	fail_unless ((c == GUTHTHILA_EMPTY_ELEMENT), "no empty element found");
 	fail_if ((p == NULL), "no name found");
 	fail_unless (!strcmp (p, "b.1"), "b.1 element differed");
@@ -103,30 +103,30 @@
 {
 	int c = 0;
 	char *p;
-	red = guththila_reader_create_for_file(environment, "resources/om/axis.xml");
-    parser = guththila_create(environment, red);
-	guththila_read (environment, parser);
-	c = guththila_next (environment, parser);
+	red = guththila_reader_create_for_file(env, "resources/om/axis.xml");
+    parser = guththila_create(env, red);
+	guththila_read (env, parser);
+	c = guththila_next (env, parser);
 
     while ((c != GUTHTHILA_END_ELEMENT))
-		c = guththila_next (environment, parser);
-	p = guththila_get_name(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_name(env, parser);
 	fail_unless ((c == GUTHTHILA_END_ELEMENT), "no end element found");
 	fail_if ((p == NULL), "no name found");
 	fail_unless (!strcmp (p, "a"), "a element differed");
 
 	c = 0;
     while ((c != GUTHTHILA_END_ELEMENT))
-		c = guththila_next (environment, parser);
-	p = guththila_get_name(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_name(env, parser);
 	fail_unless ((c == GUTHTHILA_END_ELEMENT), "no endelement found");
 	fail_if ((p == NULL), "no name found");
 	fail_unless (!strcmp (p, "b"), "b element differed");
 
 	c = 0;
     while ((c != GUTHTHILA_END_ELEMENT))
-		c = guththila_next (environment, parser);
-	p = guththila_get_name(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_name(env, parser);
 	fail_unless ((c == GUTHTHILA_END_ELEMENT), "no empty element found");
 	fail_if ((p == NULL), "no name found");
 	fail_unless (!strcmp (p, "root"), "root element differed");
@@ -138,25 +138,25 @@
 	int c = 0;
 	int i = 0;
 	char *p;
-	red = guththila_reader_create_for_file(environment, "resources/om/numbers.xml");
-    parser = guththila_create(environment, red);
-	guththila_read (environment, parser);
-	c = guththila_next (environment, parser);
+	red = guththila_reader_create_for_file(env, "resources/om/numbers.xml");
+    parser = guththila_create(env, red);
+	guththila_read (env, parser);
+	c = guththila_next (env, parser);
     while (i < 3)
 	{
 		if (c == GUTHTHILA_START_ELEMENT)
 			i++;
-		c = guththila_next (environment, parser);
+		c = guththila_next (env, parser);
 	}
 
 	if (c == GUTHTHILA_CHARACTER)
-		p = guththila_get_value(environment, parser);
+		p = guththila_get_value(env, parser);
 	fail_unless (!strcmp (p, "3"), "3 not found");
 
 	c = 0;
 	while ((c != GUTHTHILA_CHARACTER) || (parser->is_whitespace))
-		c = guththila_next (environment, parser);
-	p = guththila_get_value(environment, parser);
+		c = guththila_next (env, parser);
+	p = guththila_get_value(env, parser);
 	fail_unless (!strcmp (p, "24"), "24 not found");
 
 }

Modified: webservices/axis2/trunk/c/guththila/tests/test.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/guththila/tests/test.h?view=diff&rev=503584&r1=503583&r2=503584
==============================================================================
--- webservices/axis2/trunk/c/guththila/tests/test.h (original)
+++ webservices/axis2/trunk/c/guththila/tests/test.h Mon Feb  5 00:19:27 2007
@@ -6,7 +6,7 @@
 
 axis2_allocator_t *allocator;
 guththila_reader_t *red;
-axis2_env_t *environment;
+axis2_env_t *env;
 guththila_t *parser;
 
 void

Modified: webservices/axis2/trunk/c/guththila/tests/test_attribute.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/guththila/tests/test_attribute.c?view=diff&rev=503584&r1=503583&r2=503584
==============================================================================
--- webservices/axis2/trunk/c/guththila/tests/test_attribute.c (original)
+++ webservices/axis2/trunk/c/guththila/tests/test_attribute.c Mon Feb  5 00:19:27 2007
@@ -4,10 +4,66 @@
 
 START_TEST (test_attribute)
 {
-	red = guththila_reader_create_for_file(environment, "resources/om/axis.xml");
-    parser = guththila_create(environment, red);
-	fail_if (red == NULL, "guththila reader failed");
-	fail_if (parser == NULL, "guththila parser failed");
+	int count = 0;;
+	int c = 0;
+	guththila_attribute_t *att;
+	red = guththila_reader_create_for_file(env, "resources/om/evaluate.xml");
+    parser = guththila_create(env, red);
+	guththila_read (env, parser);
+	c = guththila_next (env, parser);
+    while (!count)
+	{
+		c = guththila_next (env, parser);
+		count = guththila_get_attribute_count(env, parser);
+		if (count)
+			att = guththila_get_attribute (env, parser);
+	}
+	fail_if (count == 0, "guththila attribute count failed");
+	fail_unless (!strcmp (guththila_get_attribute_name (env, parser, att), "color"),
+				 "guththila attribute name failed");
+	fail_unless (!strcmp (guththila_get_attribute_value (env, parser, att), "brown"),
+				 "guththila attribute value failed");
+}
+END_TEST
+
+
+START_TEST (test_attribute_prefix)
+{
+	int count = 0;;
+	int c = 0;
+	guththila_attribute_t *att;
+	red = guththila_reader_create_for_file(env, "resources/soap/soapmessage.xml");
+    parser = guththila_create(env, red);
+	guththila_read (env, parser);
+	c = guththila_next (env, parser);
+    while (!count)
+	{
+		c = guththila_next (env, parser);
+		count = guththila_get_attribute_count(env, parser);
+		if (count)
+			att = guththila_get_attribute (env, parser);
+	}
+	fail_if (count == 0, "guththila attribute count failed");
+	fail_unless (!strcmp (guththila_get_attribute_prefix (env, parser, att), "soapenv"),
+				 "guththila attribute count failed");
+	fail_unless (!strcmp (guththila_get_attribute_name (env, parser, att), "mustUnderstand"),
+				 "guththila attribute count failed");
+	fail_unless (!strcmp (guththila_get_attribute_value (env, parser, att), "0"),
+				 "guththila attribute count failed");
+	count = 0;
+    while (!count)
+	{
+		c = guththila_next (env, parser);
+		count = guththila_get_attribute_count(env, parser);
+		if (count)
+			att = guththila_get_attribute (env, parser);
+	}
+	fail_unless (!strcmp (guththila_get_attribute_prefix (env, parser, att), "soapenv"),
+				 "guththila attribute count failed");
+	fail_unless (!strcmp (guththila_get_attribute_name (env, parser, att), "mustUnderstand"),
+				 "guththila attribute count failed");
+	fail_if (!strcmp (guththila_get_attribute_value (env, parser, att), "1"),
+				 "guththila attribute count failed");
 }
 END_TEST
 
@@ -21,6 +77,7 @@
   TCase *tc_core = tcase_create ("attribute");
   tcase_add_checked_fixture (tc_core, setup, teardown);
   tcase_add_test (tc_core, test_attribute);
+  tcase_add_test (tc_core, test_attribute_prefix);
   suite_add_tcase (s, tc_core);
   return s;
 }



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