This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 3fdba8f12c Modify LoadPlanTest to not compare serialized json for
equality. (#6008)
3fdba8f12c is described below
commit 3fdba8f12c2bd98fec6718a1bd762cd47650e3b9
Author: Dave Marion <[email protected]>
AuthorDate: Tue Dec 16 12:19:26 2025 -0500
Modify LoadPlanTest to not compare serialized json for equality. (#6008)
Related to #5961
Co-authored-by: Keith Turner <[email protected]>
---
.../org/apache/accumulo/core/data/LoadPlan.java | 43 ++++++++++++++++++++++
.../apache/accumulo/core/data/LoadPlanTest.java | 5 ++-
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/core/src/main/java/org/apache/accumulo/core/data/LoadPlan.java
b/core/src/main/java/org/apache/accumulo/core/data/LoadPlan.java
index 523c2b648b..1f21a919f4 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/LoadPlan.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/LoadPlan.java
@@ -162,6 +162,28 @@ public class LoadPlan {
public RangeType getRangeType() {
return rangeType;
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(Arrays.hashCode(endRow), Arrays.hashCode(startRow),
fileName, rangeType);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Destination other = (Destination) obj;
+ return Objects.equals(fileName, other.fileName) && rangeType ==
other.rangeType
+ && Arrays.equals(endRow, other.endRow) && Arrays.equals(startRow,
other.startRow);
+ }
+
}
private LoadPlan(List<Destination> destinations) {
@@ -509,4 +531,25 @@ public class LoadPlan {
return builder.build();
}
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(destinations);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ LoadPlan other = (LoadPlan) obj;
+ return Objects.equals(destinations, other.destinations);
+ }
+
}
diff --git a/core/src/test/java/org/apache/accumulo/core/data/LoadPlanTest.java
b/core/src/test/java/org/apache/accumulo/core/data/LoadPlanTest.java
index 9e9d08a60d..9c75c6a677 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/LoadPlanTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/LoadPlanTest.java
@@ -122,7 +122,7 @@ public class LoadPlanTest {
builder.loadFileTo("f2.rf", RangeType.FILE, "004", "007");
builder.loadFileTo("f1.rf", RangeType.TABLE, "005", "006");
builder.loadFileTo("f3.rf", RangeType.TABLE, new byte[] {0, 1, 2, 3, 4, 5,
6}, null);
- String json = builder.build().toJson();
+ LoadPlan actual = builder.build();
String b64003 =
Base64.getUrlEncoder().encodeToString("003".getBytes(UTF_8));
String b64004 =
Base64.getUrlEncoder().encodeToString("004".getBytes(UTF_8));
@@ -137,7 +137,8 @@ public class LoadPlanTest {
+ "','endRow':'" + b64006 +
"','rangeType':'TABLE'},{'fileName':'f3.rf','startRow':'"
+ b64binary + "','endRow':null,'rangeType':'TABLE'}]}";
- assertEquals(expected.replace("'", "\""), json);
+ LoadPlan expectedLoadPlan = LoadPlan.fromJson(expected);
+ assertEquals(expectedLoadPlan, actual);
}
@Test