From 95168df985de9c5a1b3620f89a5de90e6b6790b8 Mon Sep 17 00:00:00 2001 From: Vivek Ratnavel Subramanian Date: Wed, 27 Feb 2019 17:31:43 -0800 Subject: [PATCH 1/6] HDDS-1093. Configuration tab in OM/SCM ui is not displaying the correct values --- .../hadoop/hdds/conf/OzoneConfiguration.java | 29 +++ .../hdds/conf/TestOzoneConfiguration.java | 171 ++++++++++++++++++ .../apache/hadoop/hdds/conf/package-info.java | 22 +++ .../main/resources/webapps/static/ozone.js | 2 - 4 files changed, 222 insertions(+), 2 deletions(-) create mode 100644 hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java create mode 100644 hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/package-info.java diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java index 43e6fe79b7c1d..9abad9df737cf 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java @@ -30,7 +30,9 @@ import javax.xml.bind.annotation.XmlRootElement; import java.net.URL; import java.util.ArrayList; +import java.util.Enumeration; import java.util.List; +import java.util.Properties; /** * Configuration for ozone. @@ -161,4 +163,31 @@ public static void activate() { Configuration.addDefaultResource("ozone-default.xml"); Configuration.addDefaultResource("ozone-site.xml"); } + + /** + * The super class method getAllPropertiesByTag + * does not override values of properties + * if there is no tag present in the configs of + * newly added resources + * @param tag + * @return Properties that belong to the tag + */ + @Override + public Properties getAllPropertiesByTag(String tag) { + // Call getProps first to load the newly added resources + // before calling super.getAllPropertiesByTag + Properties updatedProps = getProps(); + Properties propertiesByTag = super.getAllPropertiesByTag(tag); + Properties props = new Properties(); + Enumeration properties = propertiesByTag.propertyNames(); + while (properties.hasMoreElements()) { + Object propertyName = properties.nextElement(); + // get the current value of the property + Object value = updatedProps.getProperty(propertyName.toString()); + if (value != null) { + props.put(propertyName, value); + } + } + return props; + } } diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java new file mode 100644 index 0000000000000..5ad94810d5be3 --- /dev/null +++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java @@ -0,0 +1,171 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hdds.conf; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.Path; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +public class TestOzoneConfiguration { + + private Configuration conf; + final static String CONFIG = new File("./test-config-TestConfiguration.xml").getAbsolutePath(); + final static String CONFIG_CORE = new File("./core-site.xml").getAbsolutePath(); + + private BufferedWriter out; + + @Before + public void setUp() throws Exception { + conf = new OzoneConfiguration(); + } + + @After + public void tearDown() throws Exception { + if(out != null) { + out.close(); + } + new File(CONFIG).delete(); + new File(CONFIG_CORE).delete(); + } + + private void startConfig() throws IOException { + out.write("\n"); + out.write("\n"); + } + + private void endConfig() throws IOException{ + out.write("\n"); + out.flush(); + out.close(); + } + + @Test + public void testGetAllPropertiesByTags() throws Exception { + + try{ + out = new BufferedWriter(new FileWriter(CONFIG)); + startConfig(); + appendProperty("hadoop.tags.system", "YARN,HDFS,NAMENODE"); + appendProperty("hadoop.tags.custom", "MYCUSTOMTAG"); + appendPropertyByTag("dfs.cblock.trace.io", "false", "YARN"); + appendPropertyByTag("dfs.replication", "1", "HDFS"); + appendPropertyByTag("dfs.namenode.logging.level", "INFO", "NAMENODE"); + appendPropertyByTag("dfs.random.key", "XYZ", "MYCUSTOMTAG"); + endConfig(); + + Path fileResource = new Path(CONFIG); + conf.addResource(fileResource); + assertEq(conf.getAllPropertiesByTag("MYCUSTOMTAG").getProperty("dfs.random.key"), "XYZ"); + } finally { + out.close(); + } + try { + out = new BufferedWriter(new FileWriter(CONFIG_CORE)); + startConfig(); + appendProperty("dfs.random.key", "ABC"); + appendProperty("dfs.replication", "3"); + appendProperty("dfs.cblock.trace.io", "true"); + endConfig(); + + Path fileResource = new Path(CONFIG_CORE); + conf.addResource(fileResource); + + } finally { + out.close(); + } + + // Test if values are getting overridden even without tags being present + assertEq("3", conf.getAllPropertiesByTag("HDFS").getProperty("dfs.replication")); + assertEq("ABC", conf.getAllPropertiesByTag("MYCUSTOMTAG").getProperty("dfs.random.key")); + assertEq("true", conf.getAllPropertiesByTag("YARN").getProperty("dfs.cblock.trace.io")); + } + + private void appendProperty(String name, String val) throws IOException { + this.appendProperty(name, val, false, new String[0]); + } + + private void appendProperty(String name, String val, boolean isFinal, String... sources) throws IOException { + this.out.write(""); + this.out.write(""); + this.out.write(name); + this.out.write(""); + this.out.write(""); + this.out.write(val); + this.out.write(""); + if(isFinal) { + this.out.write("true"); + } + + String[] var5 = sources; + int var6 = sources.length; + + for(int var7 = 0; var7 < var6; ++var7) { + String s = var5[var7]; + this.out.write(""); + this.out.write(s); + this.out.write(""); + } + + this.out.write("\n"); + } + + private void appendPropertyByTag(String name, String val, String tags, String... sources) throws IOException { + this.appendPropertyByTag(name, val, false, tags, sources); + } + + private void appendPropertyByTag(String name, String val, boolean isFinal, String tag, String... sources) throws IOException { + this.out.write(""); + this.out.write(""); + this.out.write(name); + this.out.write(""); + this.out.write(""); + this.out.write(val); + this.out.write(""); + if(isFinal) { + this.out.write("true"); + } + + String[] var6 = sources; + int var7 = sources.length; + + for(int var8 = 0; var8 < var7; ++var8) { + String s = var6[var8]; + this.out.write(""); + this.out.write(s); + this.out.write(""); + } + + this.out.write(""); + this.out.write(tag); + this.out.write(""); + this.out.write("\n"); + } + + private static void assertEq(Object a, Object b) { + System.out.println("assertEq: " + a + ", " + b); + Assert.assertEquals(a, b); + } +} diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/package-info.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/package-info.java new file mode 100644 index 0000000000000..dd51ac826abb8 --- /dev/null +++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/package-info.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements.  See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership.  The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License.  You may obtain a copy of the License at + * + *      http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This package contains the OzoneConfiguration related tests + */ +package org.apache.hadoop.hdds.conf; \ No newline at end of file diff --git a/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.js b/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.js index c2ed2adce2fff..a31078cfd7b3a 100644 --- a/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.js +++ b/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.js @@ -308,7 +308,6 @@ ctrl.convertToArray(response.data); ctrl.configs = Object.values(ctrl.keyTagMap); ctrl.component = 'All'; - console.log("ajay -> " + JSON.stringify(ctrl.configs)); ctrl.sortBy('name'); }); }; @@ -326,7 +325,6 @@ if (ctrl.component != 'All' && (item['tag'].indexOf(ctrl .component) < 0)) { - console.log(item['name'] + " false tag " + item['tag']); return false; } From 305007a9cb6f6f4075a9600911b943f43bf0b30e Mon Sep 17 00:00:00 2001 From: Vivek Ratnavel Subramanian Date: Thu, 28 Feb 2019 17:45:51 -0800 Subject: [PATCH 2/6] Fix review comments v1 --- .../hadoop/hdds/conf/OzoneConfiguration.java | 2 +- .../hdds/conf/TestOzoneConfiguration.java | 158 +++++++----------- .../apache/hadoop/hdds/conf/package-info.java | 2 +- 3 files changed, 66 insertions(+), 96 deletions(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java index 9abad9df737cf..b7166c7f4762b 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java @@ -168,7 +168,7 @@ public static void activate() { * The super class method getAllPropertiesByTag * does not override values of properties * if there is no tag present in the configs of - * newly added resources + * newly added resources. * @param tag * @return Properties that belong to the tag */ diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java index 5ad94810d5be3..2690b6cab9b52 100644 --- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java +++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java @@ -19,44 +19,35 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.*; +import org.junit.rules.TemporaryFolder; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; +/** + * Test class for OzoneConfiguration. + */ public class TestOzoneConfiguration { private Configuration conf; - final static String CONFIG = new File("./test-config-TestConfiguration.xml").getAbsolutePath(); - final static String CONFIG_CORE = new File("./core-site.xml").getAbsolutePath(); - private BufferedWriter out; + @Rule + public TemporaryFolder temp_configs = new TemporaryFolder(); @Before public void setUp() throws Exception { conf = new OzoneConfiguration(); } - @After - public void tearDown() throws Exception { - if(out != null) { - out.close(); - } - new File(CONFIG).delete(); - new File(CONFIG_CORE).delete(); - } - - private void startConfig() throws IOException { + private void startConfig(BufferedWriter out) throws IOException { out.write("\n"); out.write("\n"); } - private void endConfig() throws IOException{ + private void endConfig(BufferedWriter out) throws IOException{ out.write("\n"); out.flush(); out.close(); @@ -64,37 +55,33 @@ private void endConfig() throws IOException{ @Test public void testGetAllPropertiesByTags() throws Exception { - - try{ - out = new BufferedWriter(new FileWriter(CONFIG)); - startConfig(); - appendProperty("hadoop.tags.system", "YARN,HDFS,NAMENODE"); - appendProperty("hadoop.tags.custom", "MYCUSTOMTAG"); - appendPropertyByTag("dfs.cblock.trace.io", "false", "YARN"); - appendPropertyByTag("dfs.replication", "1", "HDFS"); - appendPropertyByTag("dfs.namenode.logging.level", "INFO", "NAMENODE"); - appendPropertyByTag("dfs.random.key", "XYZ", "MYCUSTOMTAG"); - endConfig(); - - Path fileResource = new Path(CONFIG); + File coreDefault = temp_configs.newFile("core-default-test.xml"); + File coreSite = temp_configs.newFile("core-site-test.xml"); + try(BufferedWriter out = new BufferedWriter(new FileWriter(coreDefault))){ + startConfig(out); + appendProperty(out, "hadoop.tags.system", "YARN,HDFS,NAMENODE"); + appendProperty(out, "hadoop.tags.custom", "MYCUSTOMTAG"); + appendPropertyByTag(out, "dfs.cblock.trace.io", "false", "YARN"); + appendPropertyByTag(out, "dfs.replication", "1", "HDFS"); + appendPropertyByTag(out, "dfs.namenode.logging.level", "INFO", + "NAMENODE"); + appendPropertyByTag(out, "dfs.random.key", "XYZ", "MYCUSTOMTAG"); + endConfig(out); + + Path fileResource = new Path(coreDefault.getAbsolutePath()); conf.addResource(fileResource); assertEq(conf.getAllPropertiesByTag("MYCUSTOMTAG").getProperty("dfs.random.key"), "XYZ"); - } finally { - out.close(); } - try { - out = new BufferedWriter(new FileWriter(CONFIG_CORE)); - startConfig(); - appendProperty("dfs.random.key", "ABC"); - appendProperty("dfs.replication", "3"); - appendProperty("dfs.cblock.trace.io", "true"); - endConfig(); - - Path fileResource = new Path(CONFIG_CORE); - conf.addResource(fileResource); - } finally { - out.close(); + try(BufferedWriter out = new BufferedWriter(new FileWriter(coreSite))) { + startConfig(out); + appendProperty(out, "dfs.random.key", "ABC"); + appendProperty(out, "dfs.replication", "3"); + appendProperty(out, "dfs.cblock.trace.io", "true"); + endConfig(out); + + Path fileResource = new Path(coreSite.getAbsolutePath()); + conf.addResource(fileResource); } // Test if values are getting overridden even without tags being present @@ -103,65 +90,48 @@ public void testGetAllPropertiesByTags() throws Exception { assertEq("true", conf.getAllPropertiesByTag("YARN").getProperty("dfs.cblock.trace.io")); } - private void appendProperty(String name, String val) throws IOException { - this.appendProperty(name, val, false, new String[0]); + private void appendProperty(BufferedWriter out, String name, String val) + throws IOException { + this.appendProperty(out, name, val, false); } - private void appendProperty(String name, String val, boolean isFinal, String... sources) throws IOException { - this.out.write(""); - this.out.write(""); - this.out.write(name); - this.out.write(""); - this.out.write(""); - this.out.write(val); - this.out.write(""); + private void appendProperty(BufferedWriter out, String name, String val, + boolean isFinal) throws IOException { + out.write(""); + out.write(""); + out.write(name); + out.write(""); + out.write(""); + out.write(val); + out.write(""); if(isFinal) { - this.out.write("true"); + out.write("true"); } - - String[] var5 = sources; - int var6 = sources.length; - - for(int var7 = 0; var7 < var6; ++var7) { - String s = var5[var7]; - this.out.write(""); - this.out.write(s); - this.out.write(""); - } - - this.out.write("\n"); + out.write("\n"); } - private void appendPropertyByTag(String name, String val, String tags, String... sources) throws IOException { - this.appendPropertyByTag(name, val, false, tags, sources); + private void appendPropertyByTag(BufferedWriter out, String name, String val, + String tags) throws IOException { + this.appendPropertyByTag(out, name, val, false, tags); } - private void appendPropertyByTag(String name, String val, boolean isFinal, String tag, String... sources) throws IOException { - this.out.write(""); - this.out.write(""); - this.out.write(name); - this.out.write(""); - this.out.write(""); - this.out.write(val); - this.out.write(""); + private void appendPropertyByTag(BufferedWriter out, String name, String val, + boolean isFinal, + String tag) throws IOException { + out.write(""); + out.write(""); + out.write(name); + out.write(""); + out.write(""); + out.write(val); + out.write(""); if(isFinal) { - this.out.write("true"); + out.write("true"); } - - String[] var6 = sources; - int var7 = sources.length; - - for(int var8 = 0; var8 < var7; ++var8) { - String s = var6[var8]; - this.out.write(""); - this.out.write(s); - this.out.write(""); - } - - this.out.write(""); - this.out.write(tag); - this.out.write(""); - this.out.write("\n"); + out.write(""); + out.write(tag); + out.write(""); + out.write("\n"); } private static void assertEq(Object a, Object b) { diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/package-info.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/package-info.java index dd51ac826abb8..e72c902045b47 100644 --- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/package-info.java +++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/package-info.java @@ -17,6 +17,6 @@ */ /** - * This package contains the OzoneConfiguration related tests + * This package contains the OzoneConfiguration related tests. */ package org.apache.hadoop.hdds.conf; \ No newline at end of file From 2c76ce691524b539421c4728856955afce569633 Mon Sep 17 00:00:00 2001 From: Vivek Ratnavel Subramanian Date: Fri, 1 Mar 2019 12:38:43 -0800 Subject: [PATCH 3/6] Fix checkstyle warnings --- .../hdds/conf/TestOzoneConfiguration.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java index 2690b6cab9b52..30f8e9915bf97 100644 --- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java +++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,7 +35,7 @@ public class TestOzoneConfiguration { private Configuration conf; @Rule - public TemporaryFolder temp_configs = new TemporaryFolder(); + public TemporaryFolder tempConfigs = new TemporaryFolder(); @Before public void setUp() throws Exception { @@ -47,7 +47,7 @@ private void startConfig(BufferedWriter out) throws IOException { out.write("\n"); } - private void endConfig(BufferedWriter out) throws IOException{ + private void endConfig(BufferedWriter out) throws IOException { out.write("\n"); out.flush(); out.close(); @@ -55,9 +55,9 @@ private void endConfig(BufferedWriter out) throws IOException{ @Test public void testGetAllPropertiesByTags() throws Exception { - File coreDefault = temp_configs.newFile("core-default-test.xml"); - File coreSite = temp_configs.newFile("core-site-test.xml"); - try(BufferedWriter out = new BufferedWriter(new FileWriter(coreDefault))){ + File coreDefault = tempConfigs.newFile("core-default-test.xml"); + File coreSite = tempConfigs.newFile("core-site-test.xml"); + try (BufferedWriter out = new BufferedWriter(new FileWriter(coreDefault))) { startConfig(out); appendProperty(out, "hadoop.tags.system", "YARN,HDFS,NAMENODE"); appendProperty(out, "hadoop.tags.custom", "MYCUSTOMTAG"); @@ -70,10 +70,11 @@ public void testGetAllPropertiesByTags() throws Exception { Path fileResource = new Path(coreDefault.getAbsolutePath()); conf.addResource(fileResource); - assertEq(conf.getAllPropertiesByTag("MYCUSTOMTAG").getProperty("dfs.random.key"), "XYZ"); + assertEq(conf.getAllPropertiesByTag("MYCUSTOMTAG") + .getProperty("dfs.random.key"), "XYZ"); } - try(BufferedWriter out = new BufferedWriter(new FileWriter(coreSite))) { + try (BufferedWriter out = new BufferedWriter(new FileWriter(coreSite))) { startConfig(out); appendProperty(out, "dfs.random.key", "ABC"); appendProperty(out, "dfs.replication", "3"); @@ -85,9 +86,12 @@ public void testGetAllPropertiesByTags() throws Exception { } // Test if values are getting overridden even without tags being present - assertEq("3", conf.getAllPropertiesByTag("HDFS").getProperty("dfs.replication")); - assertEq("ABC", conf.getAllPropertiesByTag("MYCUSTOMTAG").getProperty("dfs.random.key")); - assertEq("true", conf.getAllPropertiesByTag("YARN").getProperty("dfs.cblock.trace.io")); + assertEq("3", conf.getAllPropertiesByTag("HDFS") + .getProperty("dfs.replication")); + assertEq("ABC", conf.getAllPropertiesByTag("MYCUSTOMTAG") + .getProperty("dfs.random.key")); + assertEq("true", conf.getAllPropertiesByTag("YARN") + .getProperty("dfs.cblock.trace.io")); } private void appendProperty(BufferedWriter out, String name, String val) @@ -104,7 +108,7 @@ private void appendProperty(BufferedWriter out, String name, String val, out.write(""); out.write(val); out.write(""); - if(isFinal) { + if (isFinal) { out.write("true"); } out.write("\n"); @@ -125,7 +129,7 @@ private void appendPropertyByTag(BufferedWriter out, String name, String val, out.write(""); out.write(val); out.write(""); - if(isFinal) { + if (isFinal) { out.write("true"); } out.write(""); From 8365df4bb1fe27200bf4c41ca6990aaa57e5a2a4 Mon Sep 17 00:00:00 2001 From: Vivek Ratnavel Subramanian Date: Tue, 5 Mar 2019 18:29:04 -0800 Subject: [PATCH 4/6] fix review comments --- .../hdds/conf/TestOzoneConfiguration.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java index 30f8e9915bf97..ef6e5a84ee956 100644 --- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java +++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java @@ -19,7 +19,10 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; -import org.junit.*; +import org.junit.Rule; +import org.junit.Before; +import org.junit.Test; +import org.junit.Assert; import org.junit.rules.TemporaryFolder; import java.io.BufferedWriter; @@ -70,7 +73,7 @@ public void testGetAllPropertiesByTags() throws Exception { Path fileResource = new Path(coreDefault.getAbsolutePath()); conf.addResource(fileResource); - assertEq(conf.getAllPropertiesByTag("MYCUSTOMTAG") + Assert.assertEquals(conf.getAllPropertiesByTag("MYCUSTOMTAG") .getProperty("dfs.random.key"), "XYZ"); } @@ -86,11 +89,11 @@ public void testGetAllPropertiesByTags() throws Exception { } // Test if values are getting overridden even without tags being present - assertEq("3", conf.getAllPropertiesByTag("HDFS") + Assert.assertEquals("3", conf.getAllPropertiesByTag("HDFS") .getProperty("dfs.replication")); - assertEq("ABC", conf.getAllPropertiesByTag("MYCUSTOMTAG") + Assert.assertEquals("ABC", conf.getAllPropertiesByTag("MYCUSTOMTAG") .getProperty("dfs.random.key")); - assertEq("true", conf.getAllPropertiesByTag("YARN") + Assert.assertEquals("true", conf.getAllPropertiesByTag("YARN") .getProperty("dfs.cblock.trace.io")); } @@ -137,9 +140,4 @@ private void appendPropertyByTag(BufferedWriter out, String name, String val, out.write(""); out.write("\n"); } - - private static void assertEq(Object a, Object b) { - System.out.println("assertEq: " + a + ", " + b); - Assert.assertEquals(a, b); - } } From 8a82b968dbd71c2682520009a4f0141fdbb733ed Mon Sep 17 00:00:00 2001 From: Vivek Ratnavel Subramanian Date: Wed, 6 Mar 2019 08:38:59 -0800 Subject: [PATCH 5/6] HDDS-1093. Force checks to rerun (empty commit) From 943fa8b6ceef3f1297914261831ea0fa1bd6c7e6 Mon Sep 17 00:00:00 2001 From: Vivek Ratnavel Subramanian Date: Wed, 6 Mar 2019 15:26:22 -0800 Subject: [PATCH 6/6] fix typos --- .../java/org/apache/hadoop/util/NodeHealthScriptRunner.java | 2 +- .../org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java | 2 +- hadoop-ozone/dist/src/main/smoketest/test.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java index cf1e46053a879..7c46c5b7ec421 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java @@ -249,7 +249,7 @@ public boolean isHealthy() { } /** - * Sets if the node is healhty or not considering disks' health also. + * Sets if the node is healthy or not considering disks' health also. * * @param isHealthy * if or not node is healthy diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java index b81050345f43c..1e9e17470c0e0 100644 --- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java +++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java @@ -518,7 +518,7 @@ public void testScmClusterIsInExpectedState1() // 3.5 seconds have elapsed for stale node, so it moves into Stale. // 7 seconds have elapsed for dead node, so it moves into dead. - // 2 Seconds have elapsed for healthy node, so it stays in healhty state. + // 2 Seconds have elapsed for healthy node, so it stays in healthy state. healthyList = nodeManager.getNodes(HEALTHY); List staleList = nodeManager.getNodes(STALE); List deadList = nodeManager.getNodes(DEAD); diff --git a/hadoop-ozone/dist/src/main/smoketest/test.sh b/hadoop-ozone/dist/src/main/smoketest/test.sh index 57044043f2de5..582fbdf7c526d 100755 --- a/hadoop-ozone/dist/src/main/smoketest/test.sh +++ b/hadoop-ozone/dist/src/main/smoketest/test.sh @@ -45,7 +45,7 @@ wait_for_datanodes(){ #Print it only if a number. Could be not a number if scm is not yet started if [[ "$datanodes" ]]; then - echo "$datanodes datanode is up and healhty (until now)" + echo "$datanodes datanode is up and healthy (until now)" fi fi