From 0425aadc78680e53000fd0108b540d6eca048516 Mon Sep 17 00:00:00 2001 From: gmcdonald Date: Sat, 13 Feb 2010 01:32:03 +0000 Subject: 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 --- neethi/test/Makefile.am | 14 + neethi/test/main.c | 362 +++++++++++++++++ .../test/policies/1.5symmetric_binding_policy.xml | 75 ++++ neethi/test/policies/Policy-for-Endpoint-1A.xml | 12 + neethi/test/policies/Policy-for-Endpoint-1B.xml | 12 + neethi/test/policies/Policy-for-Endpoint-2A.xml | 12 + neethi/test/policies/Policy-for-Endpoint-2B.xml | 12 + ...-in-Operation-1A-in-relation-to-Endpoint-1A.xml | 10 + ...-in-Operation-1A-in-relation-to-Endpoint-1B.xml | 10 + ...-in-Operation-1B-in-relation-to-Endpoint-1A.xml | 10 + ...-in-Operation-1B-in-relation-to-Endpoint-1B.xml | 10 + ...-in-Operation-2A-in-relation-to-Endpoint-2A.xml | 10 + ...-in-Operation-2A-in-relation-to-Endpoint-2B.xml | 10 + ...-in-Operation-2B-in-relation-to-Endpoint-2A.xml | 10 + ...-in-Operation-2B-in-relation-to-Endpoint-2B.xml | 10 + ...for-Operation-1A-in-relation-to-Endpoint-1A.xml | 10 + ...for-Operation-1A-in-relation-to-Endpoint-1B.xml | 10 + ...for-Operation-1B-in-relation-to-Endpoint-1A.xml | 10 + ...for-Operation-1B-in-relation-to-Endpoint-1B.xml | 10 + ...for-Operation-2A-in-relation-to-Endpoint-2A.xml | 10 + ...for-Operation-2A-in-relation-to-Endpoint-2B.xml | 10 + ...for-Operation-2B-in-relation-to-Endpoint-2A.xml | 10 + ...for-Operation-2B-in-relation-to-Endpoint-2B.xml | 10 + ...-in-Operation-1A-in-relation-to-Endpoint-1A.xml | 11 + ...-in-Operation-1A-in-relation-to-Endpoint-1B.xml | 11 + ...-in-Operation-1B-in-relation-to-Endpoint-1A.xml | 11 + ...-in-Operation-1B-in-relation-to-Endpoint-1B.xml | 11 + ...-in-Operation-2A-in-relation-to-Endpoint-2A.xml | 11 + ...-in-Operation-2A-in-relation-to-Endpoint-2B.xml | 11 + ...-in-Operation-2B-in-relation-to-Endpoint-2A.xml | 11 + ...-in-Operation-2B-in-relation-to-Endpoint-2B.xml | 11 + ...-in-Operation-1A-in-relation-to-Endpoint-1A.xml | 10 + ...-in-Operation-1A-in-relation-to-Endpoint-1B.xml | 10 + ...-in-Operation-1B-in-relation-to-Endpoint-1A.xml | 10 + ...-in-Operation-1B-in-relation-to-Endpoint-1B.xml | 10 + ...-in-Operation-2A-in-relation-to-Endpoint-2A.xml | 10 + ...-in-Operation-2A-in-relation-to-Endpoint-2B.xml | 10 + ...-in-Operation-2B-in-relation-to-Endpoint-2A.xml | 10 + ...-in-Operation-2B-in-relation-to-Endpoint-2B.xml | 10 + neethi/test/policies/Policy-for-Service-1.xml | 9 + neethi/test/policies/Policy-for-Service-2.xml | 9 + neethi/test/policies/PolicyAttachments.wsdl | 448 +++++++++++++++++++++ neethi/test/policies/asymmetric_binding_policy.xml | 70 ++++ neethi/test/policies/rm-1.0.xml | 21 + neethi/test/policies/rm-1.1.xml | 27 ++ neethi/test/policies/symmetric_binding_policy.xml | 75 ++++ neethi/test/security_context_token/build.sh | 3 + .../security_context_token_test.c | 54 +++ neethi/test/test-policy.xml | 10 + .../test-resources/different-level-policies.xml | 109 +++++ neethi/test/test-resources/echo-services.xml | 115 ++++++ neethi/test/test-resources/message-services-sc.xml | 116 ++++++ neethi/test/test-resources/services-1.xml | 51 +++ neethi/test/test-resources/services-2.xml | 76 ++++ neethi/test/test-resources/services-3.xml | 88 ++++ neethi/test/test-resources/services-4.xml | 89 ++++ neethi/test/test-resources/services-5.xml | 89 ++++ neethi/test/test-resources/services-6.xml | 86 ++++ neethi/test/test-resources/services-7.xml | 89 ++++ neethi/test/test-resources/services-8.xml | 89 ++++ neethi/test/test-resources/services-9.xml | 87 ++++ neethi/test/test-resources/services-sc-1.xml | 176 ++++++++ neethi/test/test-resources/services-sc-2.xml | 186 +++++++++ neethi/test/test.c | 239 +++++++++++ 64 files changed, 3238 insertions(+) create mode 100644 neethi/test/Makefile.am create mode 100644 neethi/test/main.c create mode 100644 neethi/test/policies/1.5symmetric_binding_policy.xml create mode 100644 neethi/test/policies/Policy-for-Endpoint-1A.xml create mode 100644 neethi/test/policies/Policy-for-Endpoint-1B.xml create mode 100644 neethi/test/policies/Policy-for-Endpoint-2A.xml create mode 100644 neethi/test/policies/Policy-for-Endpoint-2B.xml create mode 100644 neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1A.xml create mode 100644 neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1B.xml create mode 100644 neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1A.xml create mode 100644 neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1B.xml create mode 100644 neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2A.xml create mode 100644 neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2B.xml create mode 100644 neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2A.xml create mode 100644 neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2B.xml create mode 100644 neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1A.xml create mode 100644 neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1B.xml create mode 100644 neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1A.xml create mode 100644 neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1B.xml create mode 100644 neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2A.xml create mode 100644 neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2B.xml create mode 100644 neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2A.xml create mode 100644 neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2B.xml create mode 100644 neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1A.xml create mode 100644 neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1B.xml create mode 100644 neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1A.xml create mode 100644 neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1B.xml create mode 100644 neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2A.xml create mode 100644 neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2B.xml create mode 100644 neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2A.xml create mode 100644 neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2B.xml create mode 100644 neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1A.xml create mode 100644 neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1B.xml create mode 100644 neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1A.xml create mode 100644 neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1B.xml create mode 100644 neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2A.xml create mode 100644 neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2B.xml create mode 100644 neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2A.xml create mode 100644 neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2B.xml create mode 100644 neethi/test/policies/Policy-for-Service-1.xml create mode 100644 neethi/test/policies/Policy-for-Service-2.xml create mode 100644 neethi/test/policies/PolicyAttachments.wsdl create mode 100644 neethi/test/policies/asymmetric_binding_policy.xml create mode 100644 neethi/test/policies/rm-1.0.xml create mode 100644 neethi/test/policies/rm-1.1.xml create mode 100644 neethi/test/policies/symmetric_binding_policy.xml create mode 100644 neethi/test/security_context_token/build.sh create mode 100644 neethi/test/security_context_token/security_context_token_test.c create mode 100644 neethi/test/test-policy.xml create mode 100644 neethi/test/test-resources/different-level-policies.xml create mode 100644 neethi/test/test-resources/echo-services.xml create mode 100644 neethi/test/test-resources/message-services-sc.xml create mode 100644 neethi/test/test-resources/services-1.xml create mode 100644 neethi/test/test-resources/services-2.xml create mode 100644 neethi/test/test-resources/services-3.xml create mode 100644 neethi/test/test-resources/services-4.xml create mode 100644 neethi/test/test-resources/services-5.xml create mode 100644 neethi/test/test-resources/services-6.xml create mode 100644 neethi/test/test-resources/services-7.xml create mode 100644 neethi/test/test-resources/services-8.xml create mode 100644 neethi/test/test-resources/services-9.xml create mode 100644 neethi/test/test-resources/services-sc-1.xml create mode 100644 neethi/test/test-resources/services-sc-2.xml create mode 100644 neethi/test/test.c (limited to 'neethi/test') diff --git a/neethi/test/Makefile.am b/neethi/test/Makefile.am new file mode 100644 index 0000000..b7ace58 --- /dev/null +++ b/neethi/test/Makefile.am @@ -0,0 +1,14 @@ +TESTS = +noinst_PROGRAMS = test + +test_SOURCES = test.c + +INCLUDES = -I$(top_builddir)/include \ + -I ../../util/include \ + -I ../../axiom/include \ + -I ../../include + +test_LDADD = $(top_builddir)/src/libneethi.la \ + ../../axiom/src/om/libaxis2_axiom.la \ + ../../util/src/libaxutil.la \ + ../src/libneethi.la diff --git a/neethi/test/main.c b/neethi/test/main.c new file mode 100644 index 0000000..53ec367 --- /dev/null +++ b/neethi/test/main.c @@ -0,0 +1,362 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +axis2_status_t AXIS2_CALL om_node_serialize( + axiom_node_t * node, + const axutil_env_t * env); + +/*axis2_status_t AXIS2_CALL +load_policy_array( + axutil_array_list_t *arraylist, + axis2_char_t *file_name, + const axutil_env_t *env); +*/ +axis2_status_t AXIS2_CALL load_policy_array( + axutil_array_list_t * arraylist, + axiom_node_t * root, + const axutil_env_t * env); + +axiom_node_t *return_policy_element( + axis2_char_t * name, + const axutil_env_t * env, + axis2_char_t * wsdl_name); + +axis2_char_t *get_policy_ref( + axiom_node_t * node, + const axutil_env_t * env); + +void get_all_policy( + axis2_char_t * element_name, + const axutil_env_t * env, + axutil_array_list_t * policy_node_list, + axis2_char_t * wsdl_name); + +neethi_policy_t *AXIS2_CALL merge_policylist( + axutil_array_list_t * arraylist, + const axutil_env_t * env); + +int +main( + int argc, + char **argv) +{ + axis2_status_t status = AXIS2_FAILURE; + int i = 0; + axutil_array_list_t *policy_list = NULL; + axutil_array_list_t *policy_node_list = NULL; + neethi_policy_t *resultant = NULL; + axutil_allocator_t *allocator = axutil_allocator_init(NULL); + axutil_error_t *error = axutil_error_create(allocator); + const axutil_env_t *env = axutil_env_create_with_error(allocator, error); + + policy_list = axutil_array_list_create(env, 0); + policy_node_list = axutil_array_list_create(env, 0); + + get_all_policy(argv[1], env, policy_node_list, argv[2]); + + for (i = 0; i < axutil_array_list_size(policy_node_list, env); i++) + { + axiom_node_t *node = NULL; + node = (axiom_node_t *) axutil_array_list_get(policy_node_list, env, i); + status = load_policy_array(policy_list, node, env); + } + + resultant = merge_policylist(policy_list, env); + if (!resultant) + { + printf("Error Merging\n"); + return 0; + } + else + { + axiom_node_t *s_node = NULL; + axis2_char_t *buff = NULL; + s_node = neethi_engine_serialize(resultant, env); + if (!s_node) + { + printf("Serializing failed\n"); + return 0; + } + buff = axiom_node_to_string(s_node, env); + printf("\n%s", buff); + } + printf("Successful\n"); + return 0; + +} + +neethi_policy_t *AXIS2_CALL +merge_policylist( + axutil_array_list_t * arraylist, + const axutil_env_t * env) +{ + int i = 0; + neethi_policy_t *policy = NULL; + neethi_policy_t *result = NULL; + + result = (neethi_policy_t *) axutil_array_list_get(arraylist, env, 0); + result = + (neethi_policy_t *) neethi_engine_get_normalize(env, AXIS2_FALSE, + result); + + for (i = 1; i < axutil_array_list_size(arraylist, env); i++) + { + policy = (neethi_policy_t *) axutil_array_list_get(arraylist, env, i); + policy = + (neethi_policy_t *) neethi_engine_get_normalize(env, AXIS2_FALSE, + policy); + result = (neethi_policy_t *) neethi_engine_merge(env, policy, result); + } + return result; +} + +axis2_status_t AXIS2_CALL +om_node_serialize( + axiom_node_t * node, + const axutil_env_t * env) +{ + + axiom_output_t *om_output = NULL; + axiom_xml_writer_t *writer = NULL; + axis2_char_t *output_buffer = NULL; + axis2_status_t status = AXIS2_FAILURE; + + writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0, + AXIS2_XML_PARSER_TYPE_BUFFER); + om_output = axiom_output_create(env, writer); + + status = axiom_node_serialize(node, env, om_output); + if (status != AXIS2_SUCCESS) + { + printf("\naxiom_node_serialize failed\n"); + return 0; + } + else + printf("\naxiom_node_serialize success\n"); + /* end serializing stuff */ + + /*axiom_node_free_tree(node1, env); */ + output_buffer = (axis2_char_t *) axiom_xml_writer_get_xml(writer, env); + + printf("\nend test_om_serialize\n"); + +} + +axis2_status_t AXIS2_CALL +load_policy_array( + axutil_array_list_t * arraylist, + axiom_node_t * root, + const axutil_env_t * env) +{ + + axiom_element_t *root_ele = NULL; + + if (root) + { + if (axiom_node_get_node_type(root, env) == AXIOM_ELEMENT) + { + root_ele = + (axiom_element_t *) axiom_node_get_data_element(root, env); + if (root_ele) + { + neethi_policy_t *neethi_policy = NULL; + neethi_policy = neethi_engine_get_policy(env, root, root_ele); + if (!neethi_policy) + { + printf("Policy Creation fails\n"); + return AXIS2_FAILURE; + } + axutil_array_list_add(arraylist, env, neethi_policy); + } + } + } + return AXIS2_SUCCESS; +} + +axiom_node_t * +return_policy_element( + axis2_char_t * name, + const axutil_env_t * env, + axis2_char_t * wsdl_name) +{ + axiom_element_t *ele1 = NULL, + *ele2 = NULL; + axiom_document_t *document = NULL; + axiom_node_t *node1 = NULL, + *node2 = NULL, + *policy_node = NULL; + axiom_namespace_t *ns = NULL; + axiom_xml_reader_t *reader = NULL; + axiom_stax_builder_t *builder = NULL; + char *buffer = NULL; + axiom_attribute_t *attr = NULL; + axis2_char_t *value = NULL; + axis2_char_t *val = NULL; + axutil_hash_t *attr_hash = NULL; + axis2_char_t *xml_output = NULL; + axutil_hash_index_t *hi; + +/* + f = fopen(wsdl_name, "r"); + if (!f) + return NULL; + + reader = axiom_xml_reader_create_for_io(env, read_input, NULL , NULL, NULL); +*/ + reader = axiom_xml_reader_create_for_file(env, wsdl_name, NULL); + + if (!reader) + { + printf("ERROR CREATING PULLPARSER"); + return NULL; + } + + builder = axiom_stax_builder_create(env, reader); + + if (!builder) + { + printf("ERROR CREATING PULL PARSER"); + return NULL; + } + + document = axiom_stax_builder_get_document(builder, env); + if (!document) + return NULL; + + node1 = axiom_document_get_root_element(document, env); + if (!node1) + { + printf(" root element null "); + axiom_stax_builder_free(builder, env); + return NULL; + } + + do + { + node2 = axiom_document_build_next(document, env); + + if (!node2) + break; + + if (axiom_node_get_node_type(node2, env) == AXIOM_ELEMENT) + { + ele2 = (axiom_element_t *) axiom_node_get_data_element(node2, env); + attr_hash = axiom_element_get_all_attributes(ele2, env); + if (attr_hash) + { + hi = axutil_hash_first(attr_hash, env); + axutil_hash_this(hi, NULL, NULL, &attr); + + if (axutil_strcmp(axiom_attribute_get_value(attr, env), name) == + 0) + { + policy_node = node2; + } + } + } + } + while (node2); + return policy_node; +} + +axis2_char_t * +get_policy_ref( + axiom_node_t * node, + const axutil_env_t * env) +{ + axiom_element_t *policy_element = NULL; + axiom_children_iterator_t *children_iter = NULL; + axiom_node_t *child_node = NULL; + axutil_qname_t *qname = NULL; + axis2_char_t *value = NULL; + axis2_char_t *val = NULL; + axiom_attribute_t *attr = NULL; + + policy_element = (axiom_element_t *) axiom_node_get_data_element(node, env); + children_iter = axiom_element_get_children(policy_element, env, node); + + while (axiom_children_iterator_has_next(children_iter, env)) + { + child_node = axiom_children_iterator_next(children_iter, env); + if (axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT) + { + policy_element = + (axiom_element_t *) axiom_node_get_data_element(child_node, + env); + + if (axutil_strcmp + (axiom_element_get_localname(policy_element, env), + "PolicyReference") == 0) + { + qname = axutil_qname_create(env, "URI", NULL, NULL); + attr = axiom_element_get_attribute(policy_element, env, qname); + + if (attr) + { + value = axiom_attribute_get_value(attr, env); + val = axutil_string_substring_starting_at(value, 1); + return val; + } + } + } + } + return NULL; +} + +void +get_all_policy( + axis2_char_t * element_name, + const axutil_env_t * env, + axutil_array_list_t * policy_node_list, + axis2_char_t * wsdl_name) +{ + axutil_hash_t *attr_hash = NULL; + axutil_hash_index_t *hi = NULL; + axiom_element_t *element = NULL; + axiom_attribute_t *attribute = NULL; + axis2_char_t *attribute_val = NULL; + axiom_node_t *parent_policy_node = NULL, + *parent_node = NULL; + + parent_node = return_policy_element(element_name, env, wsdl_name); + if (!parent_node) + return; + + parent_policy_node = + return_policy_element(get_policy_ref(parent_node, env), env, wsdl_name); + axutil_array_list_add(policy_node_list, env, parent_policy_node); + + if (axiom_node_get_node_type(parent_node, env) == AXIOM_ELEMENT) + { + element = + (axiom_element_t *) axiom_node_get_data_element(parent_node, env); + attr_hash = axiom_element_get_all_attributes(element, env); + if (attr_hash) + { + hi = axutil_hash_next(env, axutil_hash_first(attr_hash, env)); + do + { + if (hi) + { + axutil_hash_this(hi, NULL, NULL, &attribute); + attribute_val = axiom_attribute_get_value(attribute, env); + attribute_val = axutil_rindex(attribute_val, ':'); + attribute_val = + axutil_string_substring_starting_at(attribute_val, 1); + get_all_policy(attribute_val, env, policy_node_list, + wsdl_name); + hi = axutil_hash_next(env, hi); + } + } + while (hi); + } + } + return; +} diff --git a/neethi/test/policies/1.5symmetric_binding_policy.xml b/neethi/test/policies/1.5symmetric_binding_policy.xml new file mode 100644 index 0000000..b660ac9 --- /dev/null +++ b/neethi/test/policies/1.5symmetric_binding_policy.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Alice + 360 + a + Digest + AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so + AXIS2C_HOME/bin/samples/rampart/keys/ahome/bob_cert.cert + AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_cert.cert + AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_key.pem + + + + diff --git a/neethi/test/policies/Policy-for-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Endpoint-1A.xml new file mode 100644 index 0000000..ff1a54f --- /dev/null +++ b/neethi/test/policies/Policy-for-Endpoint-1A.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Endpoint-1B.xml new file mode 100644 index 0000000..4df87e6 --- /dev/null +++ b/neethi/test/policies/Policy-for-Endpoint-1B.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Endpoint-2A.xml new file mode 100644 index 0000000..1517682 --- /dev/null +++ b/neethi/test/policies/Policy-for-Endpoint-2A.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Endpoint-2B.xml new file mode 100644 index 0000000..359f4bb --- /dev/null +++ b/neethi/test/policies/Policy-for-Endpoint-2B.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1A.xml new file mode 100644 index 0000000..de6cf40 --- /dev/null +++ b/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1B.xml new file mode 100644 index 0000000..c88dafa --- /dev/null +++ b/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1A.xml new file mode 100644 index 0000000..2885491 --- /dev/null +++ b/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1B.xml new file mode 100644 index 0000000..187a7b7 --- /dev/null +++ b/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2A.xml new file mode 100644 index 0000000..60e9575 --- /dev/null +++ b/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2B.xml new file mode 100644 index 0000000..59cc4fa --- /dev/null +++ b/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2A.xml new file mode 100644 index 0000000..ee38033 --- /dev/null +++ b/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2B.xml new file mode 100644 index 0000000..883dcda --- /dev/null +++ b/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1A.xml new file mode 100644 index 0000000..dfccd95 --- /dev/null +++ b/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1B.xml new file mode 100644 index 0000000..f86c59d --- /dev/null +++ b/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1A.xml new file mode 100644 index 0000000..1f39527 --- /dev/null +++ b/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1B.xml new file mode 100644 index 0000000..180e72f --- /dev/null +++ b/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2A.xml new file mode 100644 index 0000000..07efde6 --- /dev/null +++ b/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2B.xml new file mode 100644 index 0000000..071fe79 --- /dev/null +++ b/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2A.xml new file mode 100644 index 0000000..2356e7e --- /dev/null +++ b/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2B.xml new file mode 100644 index 0000000..2a1787b --- /dev/null +++ b/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1A.xml new file mode 100644 index 0000000..084aa48 --- /dev/null +++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1A.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1B.xml new file mode 100644 index 0000000..7873554 --- /dev/null +++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1B.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1A.xml new file mode 100644 index 0000000..83acbfb --- /dev/null +++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1A.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1B.xml new file mode 100644 index 0000000..238a6dc --- /dev/null +++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1B.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2A.xml new file mode 100644 index 0000000..df84817 --- /dev/null +++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2A.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2B.xml new file mode 100644 index 0000000..83c6448 --- /dev/null +++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2B.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2A.xml new file mode 100644 index 0000000..e448339 --- /dev/null +++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2A.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2B.xml new file mode 100644 index 0000000..f0332c8 --- /dev/null +++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2B.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1A.xml new file mode 100644 index 0000000..7bb10e5 --- /dev/null +++ b/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1B.xml new file mode 100644 index 0000000..76493bb --- /dev/null +++ b/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1A.xml new file mode 100644 index 0000000..f4734e7 --- /dev/null +++ b/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1B.xml new file mode 100644 index 0000000..4bffd4e --- /dev/null +++ b/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2A.xml new file mode 100644 index 0000000..3cdbe39 --- /dev/null +++ b/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2B.xml new file mode 100644 index 0000000..54be84f --- /dev/null +++ b/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2A.xml new file mode 100644 index 0000000..a891bfc --- /dev/null +++ b/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2A.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2B.xml new file mode 100644 index 0000000..4dfc80a --- /dev/null +++ b/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2B.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Service-1.xml b/neethi/test/policies/Policy-for-Service-1.xml new file mode 100644 index 0000000..a94a159 --- /dev/null +++ b/neethi/test/policies/Policy-for-Service-1.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/neethi/test/policies/Policy-for-Service-2.xml b/neethi/test/policies/Policy-for-Service-2.xml new file mode 100644 index 0000000..b57b6cf --- /dev/null +++ b/neethi/test/policies/Policy-for-Service-2.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/neethi/test/policies/PolicyAttachments.wsdl b/neethi/test/policies/PolicyAttachments.wsdl new file mode 100644 index 0000000..acf07c1 --- /dev/null +++ b/neethi/test/policies/PolicyAttachments.wsdl @@ -0,0 +1,448 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/neethi/test/policies/asymmetric_binding_policy.xml b/neethi/test/policies/asymmetric_binding_policy.xml new file mode 100644 index 0000000..da136af --- /dev/null +++ b/neethi/test/policies/asymmetric_binding_policy.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Alice + 360 + a + Digest + AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so + AXIS2C_HOME/bin/samples/rampart/keys/ahome/bob_cert.cert + AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_cert.cert + AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_key.pem + + + + diff --git a/neethi/test/policies/rm-1.0.xml b/neethi/test/policies/rm-1.0.xml new file mode 100644 index 0000000..353e1ba --- /dev/null +++ b/neethi/test/policies/rm-1.0.xml @@ -0,0 +1,21 @@ + + + + + + + + + /tmp/sandesha2_db + 64 + persistent + none + 10 + 1 + 1 + 4 + 4 + + + + diff --git a/neethi/test/policies/rm-1.1.xml b/neethi/test/policies/rm-1.1.xml new file mode 100644 index 0000000..6c60dbc --- /dev/null +++ b/neethi/test/policies/rm-1.1.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + 600000 + 200 + 300 + /tmp/sandesha2_db + persistent + none + 10 + 1 + 1 + 4 + 4 + + + + diff --git a/neethi/test/policies/symmetric_binding_policy.xml b/neethi/test/policies/symmetric_binding_policy.xml new file mode 100644 index 0000000..3db3ed8 --- /dev/null +++ b/neethi/test/policies/symmetric_binding_policy.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Alice + 360 + a + Digest + AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so + AXIS2C_HOME/bin/samples/rampart/keys/ahome/bob_cert.cert + AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_cert.cert + AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_key.pem + + + + diff --git a/neethi/test/security_context_token/build.sh b/neethi/test/security_context_token/build.sh new file mode 100644 index 0000000..6a5714d --- /dev/null +++ b/neethi/test/security_context_token/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +gcc security_context_token_test.c ../../../util/test/util/create_env.c -Werror -g -I$AXIS2C_HOME/include/axis2-1.2 -L$AXIS2C_HOME/lib -lneethi -laxutil -laxis2_axiom -laxis2_parser -o security_context_token diff --git a/neethi/test/security_context_token/security_context_token_test.c b/neethi/test/security_context_token/security_context_token_test.c new file mode 100644 index 0000000..6f320f3 --- /dev/null +++ b/neethi/test/security_context_token/security_context_token_test.c @@ -0,0 +1,54 @@ +#include +#include "../../../util/test/util/create_env.h" + +axutil_env_t *env = NULL; +rp_security_context_token_t * security_context_token = NULL; +axis2_char_t * inclusion = NULL ; +axis2_status_t status = AXIS2_FAILURE ; +axis2_bool_t derivedkeys ; +axis2_bool_t require_external_uri_ref; +axis2_bool_t sc10_security_context_token; + +/** @brief test options + * build a om from a client options + */ + +axis2_status_t test_security_context_token(axutil_env_t *env) +{ + security_context_token = rp_security_context_token_create(env); + inclusion = rp_security_context_token_get_inclusion(security_context_token,env); + printf("%s\n",inclusion); + status = rp_security_context_token_set_inclusion(security_context_token,env,inclusion); + if (status == AXIS2_SUCCESS) + printf("rp security context token set is success\n"); + derivedkeys = rp_security_context_token_get_derivedkeys(security_context_token,env); + status = rp_security_context_token_set_derivedkeys(security_context_token,env,derivedkeys); + if (status == AXIS2_SUCCESS) + printf("rp security token derivedkeys set is success\n"); + require_external_uri_ref = rp_security_context_token_get_require_external_uri_ref(security_context_token,env); + status = rp_security_context_token_set_require_external_uri_ref(security_context_token,env,require_external_uri_ref); + if (status == AXIS2_SUCCESS) + printf("rp security require external uri set is success\n"); + sc10_security_context_token = rp_security_context_token_get_sc10_security_context_token(security_context_token,env); + status = rp_security_context_token_set_sc10_security_context_token(security_context_token,env,sc10_security_context_token); + if (status == AXIS2_SUCCESS) + printf("rp security sc10 security token set is success\n"); + rp_security_context_token_increment_ref(security_context_token,env); + rp_security_context_token_free(security_context_token,env); + return AXIS2_SUCCESS; +} +int main() +{ + int status = AXIS2_SUCCESS; + env = create_environment(); + status = test_security_context_token(env); + if(status == AXIS2_FAILURE) + { + printf(" test failed"); + } + axutil_env_free(env); + return 0; +} + + + diff --git a/neethi/test/test-policy.xml b/neethi/test/test-policy.xml new file mode 100644 index 0000000..8e44f90 --- /dev/null +++ b/neethi/test/test-policy.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/neethi/test/test-resources/different-level-policies.xml b/neethi/test/test-resources/different-level-policies.xml new file mode 100644 index 0000000..de5a707 --- /dev/null +++ b/neethi/test/test-resources/different-level-policies.xml @@ -0,0 +1,109 @@ + + sec_echo + + + This is a testing service , to test the system is working or not + + + + http://example.com/ws/2004/09/policy/Test/EchoRequest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bob + 360 + b + Digest + /home/manjula/axis2/c/deploy/bin/samples/rampart/callback/libpwcb.so + /home/manjula/axis2/c/deploy/bin/samples/rampart/keys/bhome/alice_cert.cert + /home/manjula/axis2/c/deploy/bin/samples/rampart/keys/bhome/bob_cert.cert + /home/manjula/axis2/c/deploy/bin/samples/rampart/keys/bhome/bob_key.pem + + + + + diff --git a/neethi/test/test-resources/echo-services.xml b/neethi/test/test-resources/echo-services.xml new file mode 100644 index 0000000..c7fc88b --- /dev/null +++ b/neethi/test/test-resources/echo-services.xml @@ -0,0 +1,115 @@ + + echo + + + This is a testing service , to test the system is working or not + + + + http://ws.apache.org/axis2/c/samples/echoString + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + + + diff --git a/neethi/test/test-resources/message-services-sc.xml b/neethi/test/test-resources/message-services-sc.xml new file mode 100644 index 0000000..2f293df --- /dev/null +++ b/neethi/test/test-resources/message-services-sc.xml @@ -0,0 +1,116 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + + + diff --git a/neethi/test/test-resources/services-1.xml b/neethi/test/test-resources/services-1.xml new file mode 100644 index 0000000..4c727d3 --- /dev/null +++ b/neethi/test/test-resources/services-1.xml @@ -0,0 +1,51 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + org.apache.rampart.PWCallback + + + + + + + diff --git a/neethi/test/test-resources/services-2.xml b/neethi/test/test-resources/services-2.xml new file mode 100644 index 0000000..ec80dd5 --- /dev/null +++ b/neethi/test/test-resources/services-2.xml @@ -0,0 +1,76 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + + + + diff --git a/neethi/test/test-resources/services-3.xml b/neethi/test/test-resources/services-3.xml new file mode 100644 index 0000000..3d1bf60 --- /dev/null +++ b/neethi/test/test-resources/services-3.xml @@ -0,0 +1,88 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + + + diff --git a/neethi/test/test-resources/services-4.xml b/neethi/test/test-resources/services-4.xml new file mode 100644 index 0000000..537164f --- /dev/null +++ b/neethi/test/test-resources/services-4.xml @@ -0,0 +1,89 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + + + diff --git a/neethi/test/test-resources/services-5.xml b/neethi/test/test-resources/services-5.xml new file mode 100644 index 0000000..64fcecb --- /dev/null +++ b/neethi/test/test-resources/services-5.xml @@ -0,0 +1,89 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + + diff --git a/neethi/test/test-resources/services-6.xml b/neethi/test/test-resources/services-6.xml new file mode 100644 index 0000000..ff37936 --- /dev/null +++ b/neethi/test/test-resources/services-6.xml @@ -0,0 +1,86 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + diff --git a/neethi/test/test-resources/services-7.xml b/neethi/test/test-resources/services-7.xml new file mode 100644 index 0000000..b476623 --- /dev/null +++ b/neethi/test/test-resources/services-7.xml @@ -0,0 +1,89 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + + diff --git a/neethi/test/test-resources/services-8.xml b/neethi/test/test-resources/services-8.xml new file mode 100644 index 0000000..5e67653 --- /dev/null +++ b/neethi/test/test-resources/services-8.xml @@ -0,0 +1,89 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + useReqSigCert + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + + diff --git a/neethi/test/test-resources/services-9.xml b/neethi/test/test-resources/services-9.xml new file mode 100644 index 0000000..fbf1eda --- /dev/null +++ b/neethi/test/test-resources/services-9.xml @@ -0,0 +1,87 @@ + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + diff --git a/neethi/test/test-resources/services-sc-1.xml b/neethi/test/test-resources/services-sc-1.xml new file mode 100644 index 0000000..1bd254f --- /dev/null +++ b/neethi/test/test-resources/services-sc-1.xml @@ -0,0 +1,176 @@ + + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alice + bob + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + + + + + + JKS + sts.jks + password + + + + + + + 3 + + + BinarySecret + + + + + + + + + + + + + diff --git a/neethi/test/test-resources/services-sc-2.xml b/neethi/test/test-resources/services-sc-2.xml new file mode 100644 index 0000000..2d0febe --- /dev/null +++ b/neethi/test/test-resources/services-sc-2.xml @@ -0,0 +1,186 @@ + + + + + + + org.apache.rampart.Service + + + + urn:echo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bob + alice + org.apache.rampart.PWCallback + + + + JKS + store.jks + password + + + + + JKS + store.jks + password + + + + + + + + + + + + + JKS + sts.jks + password + + + + + + + 3 + + + BinarySecret + + + + + + + + + + + + + diff --git a/neethi/test/test.c b/neethi/test/test.c new file mode 100644 index 0000000..9585599 --- /dev/null +++ b/neethi/test/test.c @@ -0,0 +1,239 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +axis2_status_t AXIS2_CALL om_node_serialize( + axiom_node_t * node, + const axutil_env_t * env); + +int +main( + int argc, + char **argv) +{ + /*axutil_allocator_t *allocator = axutil_allocator_init(NULL); + axutil_error_t *error = axutil_error_create(allocator); + const axutil_env_t *env = axutil_env_create_with_error(allocator, error);*/ + const axutil_env_t *env = NULL; + axiom_xml_reader_t *reader = NULL; + axiom_stax_builder_t *builder = NULL; + axiom_document_t *document = NULL; + axiom_node_t *root = NULL; + axiom_element_t *root_ele = NULL; + + env = axutil_env_create_all("test.log", AXIS2_LOG_LEVEL_TRACE); + + reader = axiom_xml_reader_create_for_file(env, argv[1], NULL); + + if (!reader) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_CREATING_XML_STREAM_READER, + AXIS2_FAILURE); + printf("xml reader creation failed\n"); + return 0; + } + + builder = axiom_stax_builder_create(env, reader); + if (!builder) + { + axiom_xml_reader_free(reader, env); + printf("Builder creation failed\n"); + return 0; + } + document = axiom_stax_builder_get_document(builder, env); + if (!document) + { + axiom_stax_builder_free(builder, env); + printf("Document creation failed\n"); + return 0; + } + + /*root = axiom_document_get_root_element(document, env); */ + root = axiom_document_build_all(document, env); + if (!root) + { + axiom_stax_builder_free(builder, env); + return 0; + } + + if (root) + { + if (axiom_node_get_node_type(root, env) == AXIOM_ELEMENT) + { + root_ele = + (axiom_element_t *) axiom_node_get_data_element(root, env); + if (root_ele) + { + neethi_policy_t *neethi_policy = NULL; + neethi_policy = neethi_engine_get_policy(env, root, root_ele); + if (!neethi_policy) + { + printf("Policy Creation fails\n"); + return 0; + } + + if(neethi_policy) + { + axis2_char_t *id = NULL; + axis2_char_t *name = NULL; + + id = neethi_policy_get_id(neethi_policy, env); + if(id) + { + printf("Id is : %s\n", id); + } + name = neethi_policy_get_name(neethi_policy, env); + if(name) + { + printf("Name is : %s\n", name); + } + neethi_policy_free(neethi_policy, env); + neethi_policy = NULL; + + printf("Successful \n"); + } + + /*else + { + axiom_node_t *s_node = NULL; + s_node = neethi_engine_serialize(neethi_policy, env); + if (!s_node) + { + printf("Serializing failed\n"); + return 0; + } + if (om_node_serialize(s_node, env) != AXIS2_SUCCESS) + return 0; + }*/ + } + } + } + + if(builder) + { + axiom_stax_builder_free(builder, env); + builder = NULL; + } + + axutil_env_free((axutil_env_t *)env); + env = NULL; + + printf("Successful\n"); + return 0; + +} + +axis2_status_t AXIS2_CALL +om_node_serialize( + axiom_node_t * node, + const axutil_env_t * env) +{ + + axiom_output_t *om_output = NULL; + axiom_xml_writer_t *writer = NULL; + axis2_char_t *output_buffer = NULL; + axis2_status_t status = AXIS2_FAILURE; + + writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0, + AXIS2_XML_PARSER_TYPE_BUFFER); + om_output = axiom_output_create(env, writer); + + status = axiom_node_serialize(node, env, om_output); + if (status != AXIS2_SUCCESS) + { + printf("\naxiom_node_serialize failed\n"); + return 0; + } + else + printf("\naxiom_node_serialize success\n"); + /* end serializing stuff */ + + /*axiom_node_free_tree(node1, environment); */ + output_buffer = (axis2_char_t *) axiom_xml_writer_get_xml(writer, env); + + printf("\nend test_om_serialize\n"); + + return AXIS2_SUCCESS; + +} + +axutil_array_list_t *AXIS2_CALL +load_policy_array( + int argc, + char **argv, + const axutil_env_t * env) +{ + + axiom_xml_reader_t *reader = NULL; + axiom_stax_builder_t *builder = NULL; + axiom_document_t *document = NULL; + axiom_node_t *root = NULL; + axiom_element_t *root_ele = NULL; + int i = 0; + axutil_array_list_t *arraylist = NULL; + + arraylist = axutil_array_list_create(env, 0); + + for (i = 1; i < argc; i++) + { + reader = axiom_xml_reader_create_for_file(env, argv[i], NULL); + + if (!reader) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_CREATING_XML_STREAM_READER, + AXIS2_FAILURE); + printf("xml reader creation failed\n"); + return NULL; + } + + builder = axiom_stax_builder_create(env, reader); + if (!builder) + { + axiom_xml_reader_free(reader, env); + printf("Builder creation failed\n"); + return NULL; + } + document = axiom_stax_builder_get_document(builder, env); + if (!document) + { + axiom_stax_builder_free(builder, env); + printf("Document creation failed\n"); + return NULL; + } + + /*root = axiom_document_get_root_element(document, env); */ + root = axiom_document_build_all(document, env); + if (!root) + { + axiom_stax_builder_free(builder, env); + return NULL; + } + if (root) + { + if (axiom_node_get_node_type(root, env) == AXIOM_ELEMENT) + { + root_ele = + (axiom_element_t *) axiom_node_get_data_element(root, env); + if (root_ele) + { + neethi_policy_t *neethi_policy = NULL; + neethi_policy = + neethi_engine_get_policy(env, root, root_ele); + if (!neethi_policy) + { + printf("Policy Creation fails\n"); + return NULL; + } + axutil_array_list_add(arraylist, env, neethi_policy); + } + } + } + } + return arraylist; +} -- cgit v1.1-32-gdbae