Skip to content
Permalink
Browse files
Fix circular dependency introduced by tests for AXISC-1627
The tests for AXISC-1627 created a circular link dependency between
axiom and guththila.  Since the tests provided with the fix relied on
axiom calls, it made sense to move the tests to the axiom subproject.
This has the benefit of testing other parsers for this issue, instead of only
guththila.
  • Loading branch information
bblough committed May 5, 2018
1 parent e85a140 commit 7ba9db8e5cc2b200572270645c52aaf84eb60b1a
Showing 3 changed files with 28 additions and 30 deletions.
@@ -402,3 +402,31 @@ TEST_F(TestOM, test_om_buffer) {

return;
}

/* AXIS2C-1627 */
TEST_F(TestOM, test_attr_special_chars)
{
axiom_namespace_t * ns = axiom_namespace_create(m_environment, "namespace", "ns");

char * attribute;
axiom_node_t * node;
axiom_node_t * deserialized_node;
axiom_element_t * element = axiom_element_create(m_environment, NULL, "el", ns, &node);

axiom_element_set_text(element, m_environment, "T1 & T2", node);
axiom_element_add_attribute(element, m_environment, axiom_attribute_create(m_environment, "name", "A1 & A2", NULL), node);

axis2_char_t * xml = axiom_node_to_string(node, m_environment);

ASSERT_STREQ(xml, "<ns:el xmlns:ns=\"namespace\" name=\"A1 &amp; A2\">T1 &amp; T2</ns:el>");

deserialized_node = axiom_node_create_from_buffer(m_environment, xml);

axiom_element_t * deserialized_element = (axiom_element_t*)axiom_node_get_data_element(deserialized_node, m_environment);

attribute = axiom_element_get_attribute_value_by_name(deserialized_element, m_environment,"name");
char * text = axiom_element_get_text(deserialized_element, m_environment, deserialized_node);

ASSERT_STREQ(attribute, "A1 & A2");
ASSERT_STREQ(text, "T1 & T2");
}
@@ -34,6 +34,5 @@ test_attribute_SOURCES = test_attribute.cc
test_attribute_LDADD = \
$(top_builddir)/src/libguththila.la \
../../util/src/libaxutil.la \
../../axiom/src/om/libaxis2_axiom.la \
$(top_builddir)/$(GTEST)/libgtest.a \
$(top_builddir)/$(GTEST)/libgtest_main.a
@@ -137,32 +137,3 @@ TEST_F(TestAttribute, test_attribute_prefix) {
m_parser = nullptr;

}

/* AXIS2C-1627 */
TEST_F(TestAttribute, test_special_chars)
{
axiom_namespace_t * ns = axiom_namespace_create(m_env, "namespace", "ns");

char * attribute;
axiom_node_t * node;
axiom_node_t * deserialized_node;
axiom_element_t * element = axiom_element_create(m_env, NULL, "el", ns, &node);

axiom_element_set_text(element, m_env, "T1 & T2", node);
axiom_element_add_attribute(element, m_env, axiom_attribute_create(m_env, "name", "A1 & A2", NULL), node);

axis2_char_t * xml = axiom_node_to_string(node, m_env);

ASSERT_STREQ(xml, "<ns:el xmlns:ns=\"namespace\" name=\"A1 &amp; A2\">T1 &amp; T2</ns:el>");

deserialized_node = axiom_node_create_from_buffer(m_env, xml);

axiom_element_t * deserialized_element = (axiom_element_t*)axiom_node_get_data_element(deserialized_node, m_env);

attribute = axiom_element_get_attribute_value_by_name(deserialized_element, m_env,"name");
char * text = axiom_element_get_text(deserialized_element, m_env, deserialized_node);

ASSERT_STREQ(attribute, "A1 & A2");
ASSERT_STREQ(text, "T1 & T2");

}

0 comments on commit 7ba9db8

Please sign in to comment.