Remove unused function from xmlutils

Function 'load_hadoop_xml_defaults_with_type_and_locale'
was used in IDH plugin.

Change-Id: Ie85deb5cda913e03b3a3e5c72a2399d1570ba54e
This commit is contained in:
Sergey Reshetnyak 2014-05-22 16:20:23 +04:00
parent 0baeb0ee5a
commit 04e8fc88e0
3 changed files with 0 additions and 77 deletions

View File

@ -1,43 +0,0 @@
<?xml version="1.0"?>
<configuration>
<!--Common hadoop property-->
<property>
<name>name1</name>
<value>value1</value>
<valuetype>String</valuetype>
<description>
<en>descr1</en>
</description>
</property>
<!--Common hadoop property without 'valuetype' tag-->
<property>
<name>name2</name>
<value>value2</value>
<description>
<en>descr2</en>
</description>
</property>
<!--Common hadoop property 3 without text in 'value' tag-->
<property>
<name>name3</name>
<value></value>
<valuetype>String</valuetype>
<description>
<en>descr3</en>
</description>
</property>
<!--Common hadoop property 4 without 'value' tag-->
<property>
<name>name4</name>
<valuetype>String</valuetype>
<description>
<en>descr4</en>
</description>
</property>
<!--Common hadoop property 5 without description-->
<property>
<name>name5</name>
<value>value5</value>
<valuetype>String</valuetype>
</property>
</configuration>

View File

@ -36,24 +36,6 @@ class XMLUtilsTestCase(unittest2.TestCase):
x.load_hadoop_xml_defaults(
'tests/unit/resources/test-default.xml'))
def test_load_xml_defaults_with_type_and_locale(self):
expected = [
{'name': u'name1', 'value': u'value1', 'type': u'String',
'description': 'descr1'},
{'name': u'name2', 'value': u'value2', 'type': u'',
'description': 'descr2'},
{'name': u'name3', 'value': '', 'type': u'String',
'description': 'descr3'},
{'name': u'name4', 'value': '', 'type': u'String',
'description': 'descr4'},
{'name': u'name5', 'value': u'value5', 'type': u'String',
'description': ''}]
actual = x.load_hadoop_xml_defaults_with_type_and_locale(
'tests/unit/resources/test-default-with-type-and-locale.xml')
self.assertListEqual(
expected,
actual)
def test_adjust_description(self):
self.assertEqual(x._adjust_field("\n"), "")
self.assertEqual(x._adjust_field("\n "), "")

View File

@ -37,22 +37,6 @@ def load_hadoop_xml_defaults(file_name):
return configs
def load_hadoop_xml_defaults_with_type_and_locale(file_name):
doc = load_xml_document(file_name)
configs = []
prop = doc.getElementsByTagName('property')
for elements in prop:
configs.append({
'name': _get_text_from_node(elements, 'name'),
'value': _get_text_from_node(elements, 'value'),
'type': _get_text_from_node(elements, 'valuetype'),
'description': _adjust_field(
_get_text_from_node(
_get_node_element(elements, 'description'), 'en'))
})
return configs
def _get_node_element(element, name):
element = element.getElementsByTagName(name)
return element[0] if element and element[0].hasChildNodes() else None