You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/05/13 15:06:51 UTC

[GitHub] [accumulo] EdColeman opened a new pull request, #2701: Use constant for keyword name in KeywordExecutable sub-classes.

EdColeman opened a new pull request, #2701:
URL: https://github.com/apache/accumulo/pull/2701

   The keyword() method inherited from KeywordExecutable returns a string that was also hard coded into the KeywordStartIT test - use a constant to establish a convention and have the declaration in one place.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] EdColeman commented on pull request #2701: Use constant for keyword name in KeywordExecutable sub-classes.

Posted by GitBox <gi...@apache.org>.
EdColeman commented on PR #2701:
URL: https://github.com/apache/accumulo/pull/2701#issuecomment-1126699003

   These changes would invalid the purpose of the test - closing without merging


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] ctubbsii commented on a diff in pull request #2701: Use constant for keyword name in KeywordExecutable sub-classes.

Posted by GitBox <gi...@apache.org>.
ctubbsii commented on code in PR #2701:
URL: https://github.com/apache/accumulo/pull/2701#discussion_r872867422


##########
test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java:
##########
@@ -109,34 +109,35 @@ public void testCheckDuplicates() {
   public void testExpectedClasses() {
     assumeTrue(new File(System.getProperty("user.dir") + "/src").exists());
     TreeMap<String,Class<? extends KeywordExecutable>> expectSet = new TreeMap<>();
-    expectSet.put("admin", Admin.class);
-    expectSet.put("check-compaction-config", CheckCompactionConfig.class);
-    expectSet.put("check-server-config", CheckServerConfig.class);
-    expectSet.put("compaction-coordinator", CoordinatorExecutable.class);
-    expectSet.put("compactor", CompactorExecutable.class);
-    expectSet.put("config-upgrade", ConfigPropertyUpgrader.class);
-    expectSet.put("convert-config", ConvertConfig.class);
-    expectSet.put("create-token", CreateToken.class);
-    expectSet.put("ec-admin", ECAdmin.class);
-    expectSet.put("gc", GCExecutable.class);
-    expectSet.put("generate-splits", GenerateSplits.class);
-    expectSet.put("help", Help.class);
-    expectSet.put("info", Info.class);
-    expectSet.put("init", Initialize.class);
-    expectSet.put("login-info", LoginProperties.class);
-    expectSet.put("manager", ManagerExecutable.class);
-    expectSet.put("master", org.apache.accumulo.manager.MasterExecutable.class);
-    expectSet.put("minicluster", MiniClusterExecutable.class);
-    expectSet.put("monitor", MonitorExecutable.class);
-    expectSet.put("rfile-info", PrintInfo.class);
-    expectSet.put("wal-info", LogReader.class);
-    expectSet.put("shell", Shell.class);
-    expectSet.put("tserver", TServerExecutable.class);
-    expectSet.put("version", Version.class);
-    expectSet.put("zookeeper", ZooKeeperMain.class);
-    expectSet.put("create-empty", CreateEmpty.class);
-    expectSet.put("split-large", SplitLarge.class);
-    expectSet.put("zoo-zap", ZooZap.class);
+    expectSet.put(Admin.EXE_NAME, Admin.class);
+    expectSet.put(CheckCompactionConfig.EXE_NAME, CheckCompactionConfig.class);

Review Comment:
   The whole point of the checks here is to ensure that the string isn't changed. By doing this level of indirection, if the value of the constant `EXE_NAME` is changed, then this test will pass, even if it shouldn't have been changed. This test no longer guards against such changes.
   This is now effectively just checking that `SomeClass.EXE_NAME == SomeClass.keyword()` for every `SomeClass`. But, that's basically tautological the way all the classes have changed.



##########
core/src/main/java/org/apache/accumulo/core/file/rfile/CreateEmpty.java:
##########
@@ -83,7 +84,7 @@ public static void main(String[] args) throws Exception {
 
   @Override
   public String keyword() {
-    return "create-empty";
+    return EXE_NAME;

Review Comment:
   I'm not sure I see the benefit of this... it seems to just relocate the constant from an inline literal to a new line that's really only ever needed once (see my subsequent comment about why it's not needed for the test).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] EdColeman commented on a diff in pull request #2701: Use constant for keyword name in KeywordExecutable sub-classes.

Posted by GitBox <gi...@apache.org>.
EdColeman commented on code in PR #2701:
URL: https://github.com/apache/accumulo/pull/2701#discussion_r872970753


##########
test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java:
##########
@@ -109,34 +109,35 @@ public void testCheckDuplicates() {
   public void testExpectedClasses() {
     assumeTrue(new File(System.getProperty("user.dir") + "/src").exists());
     TreeMap<String,Class<? extends KeywordExecutable>> expectSet = new TreeMap<>();
-    expectSet.put("admin", Admin.class);
-    expectSet.put("check-compaction-config", CheckCompactionConfig.class);
-    expectSet.put("check-server-config", CheckServerConfig.class);
-    expectSet.put("compaction-coordinator", CoordinatorExecutable.class);
-    expectSet.put("compactor", CompactorExecutable.class);
-    expectSet.put("config-upgrade", ConfigPropertyUpgrader.class);
-    expectSet.put("convert-config", ConvertConfig.class);
-    expectSet.put("create-token", CreateToken.class);
-    expectSet.put("ec-admin", ECAdmin.class);
-    expectSet.put("gc", GCExecutable.class);
-    expectSet.put("generate-splits", GenerateSplits.class);
-    expectSet.put("help", Help.class);
-    expectSet.put("info", Info.class);
-    expectSet.put("init", Initialize.class);
-    expectSet.put("login-info", LoginProperties.class);
-    expectSet.put("manager", ManagerExecutable.class);
-    expectSet.put("master", org.apache.accumulo.manager.MasterExecutable.class);
-    expectSet.put("minicluster", MiniClusterExecutable.class);
-    expectSet.put("monitor", MonitorExecutable.class);
-    expectSet.put("rfile-info", PrintInfo.class);
-    expectSet.put("wal-info", LogReader.class);
-    expectSet.put("shell", Shell.class);
-    expectSet.put("tserver", TServerExecutable.class);
-    expectSet.put("version", Version.class);
-    expectSet.put("zookeeper", ZooKeeperMain.class);
-    expectSet.put("create-empty", CreateEmpty.class);
-    expectSet.put("split-large", SplitLarge.class);
-    expectSet.put("zoo-zap", ZooZap.class);
+    expectSet.put(Admin.EXE_NAME, Admin.class);
+    expectSet.put(CheckCompactionConfig.EXE_NAME, CheckCompactionConfig.class);

Review Comment:
   I'll close this and submit a PR that updates the test documentation to include this. I was unclear on the reason for the test being constructed as it is. When adding / changing a command it is not obvious that the KeywordIT test must also be changed - well, at least until if fails, which is its purpose, but frustrating from a development perspective.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] EdColeman closed pull request #2701: Use constant for keyword name in KeywordExecutable sub-classes.

Posted by GitBox <gi...@apache.org>.
EdColeman closed pull request #2701: Use constant for keyword name in KeywordExecutable sub-classes.
URL: https://github.com/apache/accumulo/pull/2701


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org