cshannon commented on code in PR #3135:
URL: https://github.com/apache/accumulo/pull/3135#discussion_r1051620375


##########
test/src/main/java/org/apache/accumulo/test/upgrade/ConfigPropertyUpgraderIT.java:
##########
@@ -62,13 +65,35 @@ public class ConfigPropertyUpgraderIT {
   private static ZooKeeper zooKeeper;
   private static ZooReaderWriter zrw;
 
+  // Create legacy renamer for this test
+  private static final DeprecatedPropertyUtil.PropertyRenamer 
MASTER_MANAGER_RENAMER =
+      DeprecatedPropertyUtil.PropertyRenamer.renamePrefix("master.",
+          Property.MANAGER_PREFIX.getKey());
+  private static List<DeprecatedPropertyUtil.PropertyRenamer> renamers;
+
   private InstanceId instanceId = null;
 
   @TempDir
   private static File tempDir;
 
+  static {
+    try {
+      // Make the renamers list visible to be modified
+      final Field renamersField = 
DeprecatedPropertyUtil.class.getDeclaredField("renamers");
+      renamersField.setAccessible(true);
+      @SuppressWarnings("unchecked")
+      List<DeprecatedPropertyUtil.PropertyRenamer> renamers = (List<
+          DeprecatedPropertyUtil.PropertyRenamer>) 
renamersField.get(DeprecatedPropertyUtil.class);
+      ConfigPropertyUpgraderIT.renamers = renamers;
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }

Review Comment:
   I could add a public getter but I also kind of dislike how it's set up in 
general as the ranamers field should really just be an Immutable list as well. 
The issue of course is if I make it Immutable then I can't change it for 
testing. What I might do is make a second static method that takes a list of 
renamers and the original can delegate so we can pass in whatever we want for 
testing.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to