From 5e66d5ffc51090c78348fe80db780d5d5a38e1da Mon Sep 17 00:00:00 2001 From: Steve Samson Date: Wed, 3 Jul 2024 03:22:46 -0400 Subject: [PATCH] Test Debug --- .../metastore/conf/TestMetastoreConf.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/conf/TestMetastoreConf.java b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/conf/TestMetastoreConf.java index b5208c7fe75a9..35d1c60f98621 100644 --- a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/conf/TestMetastoreConf.java +++ b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/conf/TestMetastoreConf.java @@ -83,7 +83,7 @@ public void run() { } } - private void createConfFile(String fileName, boolean inConf, String envVar, + private String createConfFile(String fileName, boolean inConf, String envVar, Map properties) throws IOException { File tmpDir = new File(System.getProperty("java.io.tmpdir")); File dir = new File(tmpDir, randomFileName()); @@ -98,19 +98,30 @@ private void createConfFile(String fileName, boolean inConf, String envVar, File confFile = new File(dir, fileName); confFile.deleteOnExit(); FileWriter writer = new FileWriter(confFile); + StringBuilder sb = new StringBuilder("\n"); writer.write("\n"); for (Map.Entry entry : properties.entrySet()) { + sb.append(" \n"); writer.write(" \n"); writer.write(" "); + sb.append(" "); writer.write(entry.getKey()); + sb.append(entry.getKey()); writer.write("\n"); + sb.append("\n"); writer.write(" "); + sb.append(" "); writer.write(entry.getValue()); + sb.append(entry.getValue()); writer.write("\n"); + sb.append("\n"); writer.write(" \n"); + sb.append(" \n"); } writer.write("\n"); + sb.append("\n"); writer.close(); + return sb.toString(); } private String randomFileName() { @@ -210,9 +221,10 @@ public void readHiveSiteWithHiveConfDir() throws IOException { @Test public void readHiveSiteWithHiveHomeDir() throws IOException { - createConfFile("hive-site.xml", true, "HIVE_HOME", instaMap( + String confStr = createConfFile("hive-site.xml", true, "HIVE_HOME", instaMap( "test.bool", "false" )); + System.out.println(String.format("DBUG: Check for key - %s, val - %s in %s looking for %s", "test.bool","false", confStr, ConfVars.BOOLEAN_TEST_ENTRY)); conf = MetastoreConf.newMetastoreConf(); Assert.assertFalse(MetastoreConf.getBoolVar(conf, ConfVars.BOOLEAN_TEST_ENTRY)); } @@ -229,9 +241,11 @@ public void readHiveMetastoreSiteWithHiveConfDir() throws IOException { @Test public void readHiveMetastoreSiteWithHiveHomeDir() throws IOException { - createConfFile("hivemetastore-site.xml", true, "HIVE_HOME", instaMap( + String confStr = createConfFile("hivemetastore-site.xml", true, "HIVE_HOME", instaMap( "test.bool", "false" )); + + System.out.println(String.format("DBUG: Check for key - %s, val - %s in %s looking for %s", "test.bool","false", confStr, ConfVars.BOOLEAN_TEST_ENTRY)); conf = MetastoreConf.newMetastoreConf(); Assert.assertFalse(MetastoreConf.getBoolVar(conf, ConfVars.BOOLEAN_TEST_ENTRY)); }