Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
new Type(value = classOf[HashPartition], name = "hash"),
new Type(value = classOf[RangePartition], name = "range"),
new Type(value = classOf[SinglePartition], name = "single"),
new Type(value = classOf[OneToOnePartition], name = "oneToOne"),
new Type(value = classOf[BroadcastPartition], name = "broadcast"),
new Type(value = classOf[UnknownPartition], name = "none")
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,39 +171,21 @@ class PartitionInfoSpec extends AnyFlatSpec {
// ---------------------------------------------------------------------------

"PartitionInfo @JsonSubTypes" should
"list the current registration set (omits OneToOnePartition)" in {
// Pin: the @JsonSubTypes annotation on PartitionInfo currently registers
// HashPartition, RangePartition, SinglePartition, BroadcastPartition,
// and UnknownPartition — but NOT OneToOnePartition. The "all" claim is
// documented separately in the pendingUntilFixed test below so this
// spec only documents the present-day set.
"register every concrete PartitionInfo subclass" in {
val annotation = classOf[PartitionInfo].getAnnotation(classOf[JsonSubTypes])
val registered = annotation.value().toList.map(_.value().getSimpleName).toSet
assert(
registered == Set(
"HashPartition",
"RangePartition",
"SinglePartition",
"OneToOnePartition",
"BroadcastPartition",
"UnknownPartition"
)
)
}

it should "eventually register every concrete PartitionInfo subclass (pendingUntilFixed)" in pendingUntilFixed {
// Intended contract: every concrete PartitionInfo subtype must be
// reachable through the polymorphic dispatch on `type`, otherwise
// Jackson cannot deserialize the missing payload (today: OneToOne-
// Partition). Asserting `contains "OneToOnePartition"` here flips
// this test from Pending to a real pass once the bug is fixed —
// pendingUntilFixed inverts that and turns the now-passing
// assertion into a failure so the fix has to delete the marker
// deliberately.
val annotation = classOf[PartitionInfo].getAnnotation(classOf[JsonSubTypes])
val registered = annotation.value().toList.map(_.value().getSimpleName).toSet
assert(registered.contains("OneToOnePartition"))
}

// ---------------------------------------------------------------------------
// case-class equality
// ---------------------------------------------------------------------------
Expand Down
Loading