in core/src/main/scala/org/apache/spark/eventhubs/utils/EventHubsTestUtils.scala [195:218]
def createEventData(event: Array[Byte],
seqNo: Long,
properties: Option[Map[String, Object]]): EventData = {
val constructor = classOf[EventDataImpl].getDeclaredConstructor(classOf[Message])
constructor.setAccessible(true)
val s = seqNo.toLong.asInstanceOf[AnyRef]
// This value is not accurate. However, "offet" is never used in testing.
// Placing dummy value here because one is required in order for EventData
// to serialize/de-serialize properly during tests.
val o = s.toString.asInstanceOf[AnyRef]
val t = new Date(System.currentTimeMillis()).asInstanceOf[AnyRef]
val msgAnnotations = new MessageAnnotations(
Map(SEQUENCE_NUMBER -> s, OFFSET -> o, ENQUEUED_TIME_UTC -> t).asJava)
val body = new Data(new Binary(event))
val msg = Factory.create(null, null, msgAnnotations, null, null, body, null)
if (properties.isDefined) {
val appProperties = new ApplicationProperties(properties.get.asJava)
msg.setApplicationProperties(appProperties)
}
constructor.newInstance(msg).asInstanceOf[EventData]
}