axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r320967 - in /webservices/axis2/trunk/c/modules: test/common/ test/unit/ test/util/ util/src/ util/test/
Date Fri, 14 Oct 2005 01:55:10 GMT
Author: damitha
Date: Thu Oct 13 18:54:55 2005
New Revision: 320967

URL: http://svn.apache.org/viewcvs?rev=320967&view=rev
Log:
Added system test for hash. Also updated the build files

Modified:
    webservices/axis2/trunk/c/modules/test/common/test_common.c
    webservices/axis2/trunk/c/modules/test/unit/Makefile.am
    webservices/axis2/trunk/c/modules/test/unit/Makefile.in
    webservices/axis2/trunk/c/modules/test/util/test_util.c
    webservices/axis2/trunk/c/modules/util/src/Makefile.am
    webservices/axis2/trunk/c/modules/util/src/axis2_stream.c
    webservices/axis2/trunk/c/modules/util/test/util_hash_test.c
    webservices/axis2/trunk/c/modules/util/test/util_hash_test.h
    webservices/axis2/trunk/c/modules/util/test/util_log_test.c
    webservices/axis2/trunk/c/modules/util/test/util_log_test.h
    webservices/axis2/trunk/c/modules/util/test/util_stream_test.c
    webservices/axis2/trunk/c/modules/util/test/util_stream_test.h

Modified: webservices/axis2/trunk/c/modules/test/common/test_common.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/common/test_common.c?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/common/test_common.c (original)
+++ webservices/axis2/trunk/c/modules/test/common/test_common.c Thu Oct 13 18:54:55 2005
@@ -3,4 +3,5 @@
 
 int main()
 {
+    return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/test/unit/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/unit/Makefile.am?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/unit/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/test/unit/Makefile.am Thu Oct 13 18:54:55 2005
@@ -3,5 +3,5 @@
 AM_CPPFLAGS = $(CPPFLAGS)
 unit_test_SOURCES = main.c
 
-unit_test_LDADD   =  $(LDFLAGS) ../../common/test/libtest_common.la ../../util/test/libutil_test.la
../../common/src/libcommon.la ../../util/src/libutil.la -ldl
+unit_test_LDADD   =  $(LDFLAGS) ../../common/test/libtest_common.la ../../util/test/libtest_util.la
../../common/src/libcommon.la ../../util/src/libutil.la -ldl
 INCLUDES = -I${CUTEST_HOME}/include -I../../../include

Modified: webservices/axis2/trunk/c/modules/test/unit/Makefile.in
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/unit/Makefile.in?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/unit/Makefile.in (original)
+++ webservices/axis2/trunk/c/modules/test/unit/Makefile.in Thu Oct 13 18:54:55 2005
@@ -55,8 +55,8 @@
 unit_test_OBJECTS = $(am_unit_test_OBJECTS)
 am__DEPENDENCIES_1 =
 unit_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	../../common/test/libcommon_test.la \
-	../../util/test/libutil_test.la ../../common/src/libcommon.la \
+	../../common/test/libtest_common.la \
+	../../util/test/libtest_util.la ../../common/src/libcommon.la \
 	../../util/src/libutil.la
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
@@ -180,7 +180,7 @@
 SUBDIRS = 
 AM_CPPFLAGS = $(CPPFLAGS)
 unit_test_SOURCES = main.c
-unit_test_LDADD = $(LDFLAGS) ../../common/test/libcommon_test.la ../../util/test/libutil_test.la
../../common/src/libcommon.la ../../util/src/libutil.la -ldl
+unit_test_LDADD = $(LDFLAGS) ../../common/test/libtest_common.la ../../util/test/libtest_util.la
../../common/src/libcommon.la ../../util/src/libutil.la -ldl
 INCLUDES = -I${CUTEST_HOME}/include -I../../../include
 all: all-recursive
 

Modified: webservices/axis2/trunk/c/modules/test/util/test_util.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/util/test_util.c?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/util/test_util.c (original)
+++ webservices/axis2/trunk/c/modules/test/util/test_util.c Thu Oct 13 18:54:55 2005
@@ -1,4 +1,91 @@
-int main(void)
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <axis2_hash.h>
+#include <axis2_string.h>
+
+typedef struct a
+{
+    char *value;
+} a;
+
+
+
+int test_hash_get ()
 {
+    axis2_allocator_t *allocator = axis2_allocator_init (NULL);
+    axis2_string_t *string = axis2_allocator_init (NULL);
+    axis2_environment_t *environment =
+        axis2_environment_create (allocator, NULL, NULL, NULL, string);
+
+    axis2_hash_t *ht;
+    a *a1, *a2, *a3, *a4;
+
+    axis2_hash_index_t *i = 0;
+    void *v = NULL;
+
+    char *key1 = "key1";
+    char *key2 = "key2";
+    char *key3 = "key3";
+    char *key4 = "key4";
+
+    a1 = (a *) axis2_malloc(environment->allocator, sizeof (a));
+    a2 = (a *) axis2_malloc(environment->allocator, sizeof (a));
+    a3 = (a *) axis2_malloc(environment->allocator, sizeof (a));
+    a4 = (a *) axis2_malloc(environment->allocator, sizeof (a));
+
+
+    a1->value = axis2_strdup(environment->string, "value1");
+    a2->value = axis2_strdup(environment->string, "value2");
+    a3->value = axis2_strdup(environment->string, "value3");
+    a4->value = axis2_strdup(environment->string, "value4");
+
+
+    ht = axis2_hash_make (environment);
+
+    axis2_hash_set (ht, key1, AXIS2_HASH_KEY_STRING, a1);
+    axis2_hash_set (ht, key2, AXIS2_HASH_KEY_STRING, a2);
+    axis2_hash_set (ht, key3, AXIS2_HASH_KEY_STRING, a3);
+    axis2_hash_set (ht, key4, AXIS2_HASH_KEY_STRING, a4);
+
+    for (i = axis2_hash_first (environment, ht); i; i = axis2_hash_next (i))
+    {
+
+        axis2_hash_this (i, NULL, NULL, &v);
+
+        printf ("\n %s \n", ((a *) v)->value);
+    }
+
+    printf ("\n demo get %s ",
+            ((a *) axis2_hash_get (ht, key1, AXIS2_HASH_KEY_STRING))->value);
+
+    printf ("\n demo get %s ",
+            ((a *) axis2_hash_get (ht, key2, AXIS2_HASH_KEY_STRING))->value);
+
+    printf ("\n demo get %s ",
+            ((a *) axis2_hash_get (ht, key3, AXIS2_HASH_KEY_STRING))->value);
+
+    printf ("\n demo get %s \n",
+            ((a *) axis2_hash_get (ht, key4, AXIS2_HASH_KEY_STRING))->value);
+
     return 0;
+}
+
+int main(void)
+{
+   test_hash_get(); 
 }

Modified: webservices/axis2/trunk/c/modules/util/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/Makefile.am?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/util/src/Makefile.am Thu Oct 13 18:54:55 2005
@@ -1,6 +1,12 @@
 lib_LTLIBRARIES = libutil.la
 AM_CPPFLAGS = $(CPPFLAGS)
-libutil_la_SOURCES = axis2_hash.c axis2_allocator.c axis2_environment.c axis2_error.c axis2_stream.c
axis2_log.c
+libutil_la_SOURCES = axis2_hash.c \
+                        axis2_allocator.c \
+                        axis2_environment.c \
+                        axis2_error.c \
+                        axis2_stream.c \
+                        axis2_log.c \
+                        axis2_string.c
 
 libutil_la_LIBADD = $(LDFLAGS)
 INCLUDES = -I../../../include -I${CUTEST_HOME}/include

Modified: webservices/axis2/trunk/c/modules/util/src/axis2_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_stream.c?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_stream.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_stream.c Thu Oct 13 18:54:55 2005
@@ -72,4 +72,3 @@
         printf("%c", ((axis2_char_t*)buffer)[i]);
     return 0;
 }
-

Modified: webservices/axis2/trunk/c/modules/util/test/util_hash_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_hash_test.c?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_hash_test.c (original)
+++ webservices/axis2/trunk/c/modules/util/test/util_hash_test.c Thu Oct 13 18:54:55 2005
@@ -6,10 +6,11 @@
 } a;
 
 void Testaxis2_hash_ops_get(CuTest *tc)
-{    
+{
+	axis2_string_t *string = axis2_allocator_init (NULL);    
     axis2_allocator_t *allocator = axis2_allocator_init (NULL);
     axis2_environment_t *environment =
-        axis2_environment_create (allocator, NULL, NULL, NULL);
+        axis2_environment_create (allocator, NULL, NULL, NULL, string);
 
     axis2_hash_t *ht;
     a *actual, *expected;
@@ -22,7 +23,7 @@
     actual = (a *) axis2_malloc(environment->allocator, sizeof (a));
 
 
-    actual->value = axis2_strdup(environment->allocator, "value1");
+    actual->value = axis2_strdup(environment->string, "value1");
 
 
     ht = axis2_hash_make (environment);
@@ -39,4 +40,3 @@
     expected = (a *) axis2_hash_get (ht, key1, AXIS2_HASH_KEY_STRING);
     CuAssertStrEquals(tc, expected->value, actual->value);
 }
-

Modified: webservices/axis2/trunk/c/modules/util/test/util_hash_test.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_hash_test.h?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_hash_test.h (original)
+++ webservices/axis2/trunk/c/modules/util/test/util_hash_test.h Thu Oct 13 18:54:55 2005
@@ -7,6 +7,7 @@
 #include <axis2_allocator.h>
 #include <axis2_environment.h>
 #include <axis2_hash.h>
+#include <axis2_string.h>
 
 void Testaxis2_hash_ops_get(CuTest *tc);
 

Modified: webservices/axis2/trunk/c/modules/util/test/util_log_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_log_test.c?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_log_test.c (original)
+++ webservices/axis2/trunk/c/modules/util/test/util_log_test.c Thu Oct 13 18:54:55 2005
@@ -5,10 +5,9 @@
 
     char actual[10];
     axis2_allocator_t *allocator = axis2_allocator_init(NULL);
-    axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL);
+    axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL, NULL);
     axis2_stream_read(env->stream, actual, 10);
     axis2_log_write(env->log, actual, 10);
     char *expected = strdup("aaaaaaaaa");
     CuAssertStrEquals(tc, expected, actual);
 }
-

Modified: webservices/axis2/trunk/c/modules/util/test/util_log_test.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_log_test.h?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_log_test.h (original)
+++ webservices/axis2/trunk/c/modules/util/test/util_log_test.h Thu Oct 13 18:54:55 2005
@@ -6,6 +6,7 @@
 #include <CuTest.h>
 #include <axis2_allocator.h>
 #include <axis2_environment.h>
+#include <axis2_string.h>
 
 void Testaxis2_log_ops_write(CuTest *tc);
 

Modified: webservices/axis2/trunk/c/modules/util/test/util_stream_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_stream_test.c?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_stream_test.c (original)
+++ webservices/axis2/trunk/c/modules/util/test/util_stream_test.c Thu Oct 13 18:54:55 2005
@@ -4,7 +4,7 @@
 
     char actual[10];
     axis2_allocator_t *allocator = axis2_allocator_init(NULL);
-    axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL);
+    axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL, NULL);
     axis2_stream_read(env->stream, actual, 10);
     char *expected = strdup("aaaaaaaaa");
     CuAssertStrEquals(tc, expected, actual);
@@ -14,7 +14,7 @@
 
     char actual[10];
     axis2_allocator_t *allocator = axis2_allocator_init(NULL);
-    axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL);
+    axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL, NULL);
     axis2_stream_read(env->stream, actual, 10);
     axis2_stream_write(env->stream, actual, 10);
     char *expected = strdup("aaaaaaaaa");

Modified: webservices/axis2/trunk/c/modules/util/test/util_stream_test.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_stream_test.h?rev=320967&r1=320966&r2=320967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_stream_test.h (original)
+++ webservices/axis2/trunk/c/modules/util/test/util_stream_test.h Thu Oct 13 18:54:55 2005
@@ -6,6 +6,7 @@
 #include <CuTest.h>
 #include <axis2_allocator.h>
 #include <axis2_environment.h>
+#include <axis2_string.h>
 
 void Testaxis2_stream_ops_read(CuTest *tc);
 



Mime
View raw message