def test_hadoop_xml(self):
        tr = hct.TemplateResolver(somename="potato", workdir='')
        vals = {"fs.defaultFs": "file:///",
                "yarn.option.nested": "123",
                "templated.value": "$somename"
                }
        expected = """<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
    <name>fs.defaultFs</name>
    <value>file:///</value>
</property>
<property>
    <name>templated.value</name>
    <value>potato</value>
</property>
<property>
    <name>yarn.option.nested</name>
    <value>123</value>
</property>
</configuration>"""
        output = hcw.hadoop_xml('file.xml', vals, tr)
        print "\"%s\"" % expected
        print "\"%s\"" % output
        self.assertEqual(output, expected)
    def test_spark_defaults_conf(self):
        tr = hct.TemplateResolver(somename="potato", workdir='')
        vals = {"fs.defaultFs": "file:///",
                "yarn.option.nested": "123",
                "templated.value": "$somename"
                }
        expected = """fs.defaultFs file:///
templated.value potato
yarn.option.nested 123
"""
        output = hcw.hadoop_xml('spark-defaults.conf', vals, tr)
        self.assertEqual(output, expected)
    def test_hadoop_xml_log4j_properties(self):
        tr = hct.TemplateResolver(somename="potato", workdir='')
        vals = {"fs.defaultFs": "file:///",
                "yarn.option.nested": "123",
                "templated.value": "$somename"
                }
        expected = """fs.defaultFs=file:///
templated.value=$somename
yarn.option.nested=123
"""
        output = hcw.hadoop_xml('file.properties', vals, tr)
        print "\"%s\"" % expected
        print "\"%s\"" % output
        self.assertEqual(output, expected)