ctubbsii commented on code in PR #3135:
URL: https://github.com/apache/accumulo/pull/3135#discussion_r1051492282
##########
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());
Review Comment:
Instead of keeping that specific renamer around, can we create a dummy
renamer for testing purposes, so it's not tied to any specific previous code
that looks like it tech debt?
##########
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 think we could probably avoid the static initializer stuff and all the
type-safety check bypassing if the code we're testing is tweaked slightly to
make it easier to test with a method that makes the list visible for testing
purposes.
--
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]