Skip to content

Commit c1ea8ca

Browse files
authored
Revert Ping/Pong events. (#226)
1 parent e4f133c commit c1ea8ca

File tree

2 files changed

+6
-76
lines changed

2 files changed

+6
-76
lines changed

jicoco-mediajson/src/main/kotlin/org/jitsi/mediajson/MediaJson.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ private val objectMapper = jacksonObjectMapper().apply {
4141
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "event")
4242
@JsonSubTypes(
4343
JsonSubTypes.Type(value = MediaEvent::class, name = "media"),
44-
JsonSubTypes.Type(value = PingEvent::class, name = "ping"),
45-
JsonSubTypes.Type(value = PongEvent::class, name = "pong"),
4644
JsonSubTypes.Type(value = StartEvent::class, name = "start"),
4745
JsonSubTypes.Type(value = TranscriptionResultEvent::class, name = "transcription-result"),
4846
)
@@ -68,14 +66,6 @@ data class StartEvent(
6866
val start: Start
6967
) : Event("start")
7068

71-
data class PingEvent(
72-
val id: Int
73-
) : Event("ping")
74-
75-
data class PongEvent(
76-
val id: Int
77-
) : Event("pong")
78-
7969
@com.fasterxml.jackson.annotation.JsonIgnoreProperties(value = ["event"], allowGetters = false)
8070
class TranscriptionResultEvent : Event("transcription-result") {
8171
private val additionalProperties = mutableMapOf<String, Any?>()

jicoco-mediajson/src/test/kotlin/org/jitsi/mediajson/MediaJsonTest.kt

Lines changed: 6 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -92,38 +92,6 @@ class MediaJsonTest : ShouldSpec() {
9292
(parsed === event) shouldBe false
9393
}
9494
}
95-
context("PingEvent") {
96-
val id = 42
97-
val event = PingEvent(id)
98-
99-
context("Serializing") {
100-
val parsed = parser.parse(event.toJson())
101-
parsed.shouldBeInstanceOf<JSONObject>()
102-
parsed["event"] shouldBe "ping"
103-
parsed["id"] shouldBe id
104-
}
105-
context("Parsing") {
106-
val parsed = Event.parse(event.toJson())
107-
(parsed == event) shouldBe true
108-
(parsed === event) shouldBe false
109-
}
110-
}
111-
context("PongEvent") {
112-
val id = 123
113-
val event = PongEvent(id)
114-
115-
context("Serializing") {
116-
val parsed = parser.parse(event.toJson())
117-
parsed.shouldBeInstanceOf<JSONObject>()
118-
parsed["event"] shouldBe "pong"
119-
parsed["id"] shouldBe id
120-
}
121-
context("Parsing") {
122-
val parsed = Event.parse(event.toJson())
123-
(parsed == event) shouldBe true
124-
(parsed === event) shouldBe false
125-
}
126-
}
12795
context("TranscriptionResultEvent") {
12896
val event = TranscriptionResultEvent()
12997

@@ -225,15 +193,15 @@ class MediaJsonTest : ShouldSpec() {
225193
context("Media with seq/chunk/timestamp as numbers") {
226194
val parsed = Event.parse(
227195
"""
228-
{
196+
{
229197
"event": "media",
230-
"sequenceNumber": 2,
231-
"media": {
232-
"tag": "incoming",
233-
"chunk": 1,
198+
"sequenceNumber": 2,
199+
"media": {
200+
"tag": "incoming",
201+
"chunk": 1,
234202
"timestamp": 5,
235203
"payload": "no+JhoaJjpzSHxAKBgYJ...=="
236-
}
204+
}
237205
}
238206
""".trimIndent()
239207
)
@@ -246,34 +214,6 @@ class MediaJsonTest : ShouldSpec() {
246214
parsed.media.timestamp shouldBe 5
247215
parsed.media.payload shouldBe "no+JhoaJjpzSHxAKBgYJ...=="
248216
}
249-
context("Ping") {
250-
val parsed = Event.parse(
251-
"""
252-
{
253-
"event": "ping",
254-
"id": 42
255-
}
256-
""".trimIndent()
257-
)
258-
259-
parsed.shouldBeInstanceOf<PingEvent>()
260-
parsed.event shouldBe "ping"
261-
parsed.id shouldBe 42
262-
}
263-
context("Pong") {
264-
val parsed = Event.parse(
265-
"""
266-
{
267-
"event": "pong",
268-
"id": 123
269-
}
270-
""".trimIndent()
271-
)
272-
273-
parsed.shouldBeInstanceOf<PongEvent>()
274-
parsed.event shouldBe "pong"
275-
parsed.id shouldBe 123
276-
}
277217
context("TranscriptionResult ") {
278218
val originalJson = """
279219
{

0 commit comments

Comments
 (0)