summaryrefslogtreecommitdiffstats
path: root/util/test/properties
diff options
context:
space:
mode:
authorGravatar gmcdonald2010-02-13 01:32:03 +0000
committerGravatar gmcdonald2010-02-13 01:32:03 +0000
commit0425aadc78680e53000fd0108b540d6eca048516 (patch)
tree8ec7ab8e015d454c5ec586dfc91e05a2dce1cfc0 /util/test/properties
downloadaxis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.gz
axis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.bz2
Moving axis svn, part of TLP move INFRA-2441
git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@909681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'util/test/properties')
-rw-r--r--util/test/properties/Makefile.am13
-rw-r--r--util/test/properties/build.sh7
-rw-r--r--util/test/properties/input.doc1
-rw-r--r--util/test/properties/output.doc0
-rw-r--r--util/test/properties/property_test.c117
-rw-r--r--util/test/properties/test.doc1
6 files changed, 139 insertions, 0 deletions
diff --git a/util/test/properties/Makefile.am b/util/test/properties/Makefile.am
new file mode 100644
index 0000000..69bb83b
--- /dev/null
+++ b/util/test/properties/Makefile.am
@@ -0,0 +1,13 @@
+TESTS = property_test
+check_PROGRAMS = property_test
+noinst_PROGRAMS = property_test
+property_test_SOURCES = property_test.c ../util/create_env.c
+
+property_test_LDADD = \
+ $(top_builddir)/src/libaxutil.la
+
+INCLUDES = -I$(top_builddir)/include \
+ -I ../../../axiom/include \
+ -I ../../../include
+
+
diff --git a/util/test/properties/build.sh b/util/test/properties/build.sh
new file mode 100644
index 0000000..9948fc6
--- /dev/null
+++ b/util/test/properties/build.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+gcc property_test.c ../util/create_env.c -g -I$AXIS2C_HOME/include/axis2-1.2 -L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -o property_test
+
+
+
+
diff --git a/util/test/properties/input.doc b/util/test/properties/input.doc
new file mode 100644
index 0000000..67fd61d
--- /dev/null
+++ b/util/test/properties/input.doc
@@ -0,0 +1 @@
+This is the content of the input file
diff --git a/util/test/properties/output.doc b/util/test/properties/output.doc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/util/test/properties/output.doc
diff --git a/util/test/properties/property_test.c b/util/test/properties/property_test.c
new file mode 100644
index 0000000..e7e3a8f
--- /dev/null
+++ b/util/test/properties/property_test.c
@@ -0,0 +1,117 @@
+#include <stdio.h>
+#include <axutil_env.h>
+#include "../util/create_env.h"
+#include <axutil_properties.h>
+
+axis2_char_t *
+axutil_properties_read(
+ FILE *input,
+ const axutil_env_t *env);
+
+/** @brief test properties
+ * read file and give the output
+ */
+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;
+ }
+
+ properties = axutil_properties_create(env);
+ if(!properties)
+ {
+ 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 = axutil_properties_read(input,env);
+ if(!cur)
+ {
+ printf("Can't read properties\n");
+ axutil_property_free(properties,env);
+ return AXIS2_FAILURE;
+ }
+ 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");
+ 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 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");
+ 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(env);
+
+ if(status == AXIS2_FAILURE)
+ {
+ printf(" The test is failed\n");
+ }
+
+ axutil_env_free(env);
+ return 0;
+}
+
+
+
+
+
+
+
+
+
diff --git a/util/test/properties/test.doc b/util/test/properties/test.doc
new file mode 100644
index 0000000..d687785
--- /dev/null
+++ b/util/test/properties/test.doc
@@ -0,0 +1 @@
+this use for test perposes