Skip to content

Commit

Permalink
chore: Fix compiler warnings. (#1700)
Browse files Browse the repository at this point in the history
* chore: Fix compiler warnings.
  • Loading branch information
bgrozev authored Aug 4, 2021
1 parent c450354 commit 062e9f5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class VideobridgeTest : ShouldSpec() {
val confCreateIq = ColibriUtilities.createConferenceIq(JidCreate.from("focusJid"))
val resp = videobridge.handleColibriConferenceIQ(confCreateIq)
resp.shouldBeInstanceOf<ErrorIQ>()
resp as ErrorIQ
resp.error.condition shouldBe XMPPError.Condition.service_unavailable
}
context("and once the conference expires") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright @ 2021 - present 8x8, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("NAME_SHADOWING")

package org.jitsi.videobridge.cc.allocation

import io.kotest.core.spec.style.ShouldSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal class Vp9QualityFilterTest : ShouldSpec() {
val targetIndex = RtpLayerDesc.getIndex(0, 0, 0)

testGenerator(generator, filter, targetIndex) {
f, result ->
_, result ->
result.accept shouldBe true
result.mark shouldBe true
filter.needsKeyframe shouldBe false
Expand All @@ -46,7 +46,7 @@ internal class Vp9QualityFilterTest : ShouldSpec() {
val targetIndex = RtpLayerDesc.getIndex(0, 0, 2)

testGenerator(generator, filter, targetIndex) {
f, result ->
_, result ->
result.accept shouldBe true
result.mark shouldBe true
filter.needsKeyframe shouldBe false
Expand Down Expand Up @@ -94,7 +94,7 @@ internal class Vp9QualityFilterTest : ShouldSpec() {
}
val targetIndex2 = RtpLayerDesc.getIndex(0, 0, 2)

testGenerator(generator, filter, targetIndex2) { f, result ->
testGenerator(generator, filter, targetIndex2) { _, result ->
result.accept shouldBe true
result.mark shouldBe true
filter.needsKeyframe shouldBe false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ class BridgeChannelMessageTest : ShouldSpec() {

val parsed = JSONParser().parse(message.toJson())
parsed.shouldBeInstanceOf<JSONObject>()
parsed as JSONObject
val parsedColibriClass = parsed["colibriClass"]
parsedColibriClass.shouldBeInstanceOf<String>()
parsedColibriClass as String
parsedColibriClass shouldBe message.type
}
}
Expand All @@ -66,7 +64,6 @@ class BridgeChannelMessageTest : ShouldSpec() {
val serialized = SelectedEndpointsMessage(selectedEndpoints).toJson()
val parsed2 = parse(serialized)
parsed2.shouldBeInstanceOf<SelectedEndpointsMessage>()
parsed2 as SelectedEndpointsMessage
parsed2.selectedEndpoints shouldBe selectedEndpoints
}
}
Expand Down Expand Up @@ -111,7 +108,6 @@ class BridgeChannelMessageTest : ShouldSpec() {
val parsed = parse(json)

parsed.shouldBeInstanceOf<EndpointMessage>()
parsed as EndpointMessage
parsed.from shouldBe null
parsed.to shouldBe "to_value"
parsed.otherFields["other_field1"] shouldBe "other_value1"
Expand All @@ -137,7 +133,6 @@ class BridgeChannelMessageTest : ShouldSpec() {
val parsed = parse(original.toJson())

parsed.shouldBeInstanceOf<DominantSpeakerMessage>()
parsed as DominantSpeakerMessage
parsed.dominantSpeakerEndpoint shouldBe "d"
parsed.previousSpeakers shouldBe listOf("p1", "p2")
}
Expand All @@ -146,15 +141,13 @@ class BridgeChannelMessageTest : ShouldSpec() {
context("without a version") {
val parsed = parse(ServerHelloMessage().toJson())
parsed.shouldBeInstanceOf<ServerHelloMessage>()
parsed as ServerHelloMessage
parsed.version shouldBe null
}
context("with a version") {
val message = ServerHelloMessage("v")

val parsed = parse(message.toJson())
parsed.shouldBeInstanceOf<ServerHelloMessage>()
parsed as ServerHelloMessage
parsed.version shouldBe "v"
}
}
Expand All @@ -169,7 +162,6 @@ class BridgeChannelMessageTest : ShouldSpec() {

val parsed = parse(EndpointConnectionStatusMessage("abcdabcd", true).toJson())
parsed.shouldBeInstanceOf<EndpointConnectionStatusMessage>()
parsed as EndpointConnectionStatusMessage

parsed.endpoint shouldBe "abcdabcd"
parsed.active shouldBe "true"
Expand All @@ -182,17 +174,14 @@ class BridgeChannelMessageTest : ShouldSpec() {
val parsed = parse(message.toJson())

parsed.shouldBeInstanceOf<ForwardedEndpointsMessage>()
parsed as ForwardedEndpointsMessage

parsed.forwardedEndpoints shouldContainExactly forwardedEndpoints

// Make sure the forwardedEndpoints field is serialized as lastNEndpoints as the client (presumably) expects
val parsedJson = JSONParser().parse(message.toJson())
parsedJson.shouldBeInstanceOf<JSONObject>()
parsedJson as JSONObject
val parsedForwardedEndpoints = parsedJson["lastNEndpoints"]
parsedForwardedEndpoints.shouldBeInstanceOf<JSONArray>()
parsedForwardedEndpoints as JSONArray
parsedForwardedEndpoints.toList() shouldContainExactly forwardedEndpoints
}

Expand All @@ -207,7 +196,6 @@ class BridgeChannelMessageTest : ShouldSpec() {
val parsed = parse(senderVideoConstraintsMessage.toJson())

parsed.shouldBeInstanceOf<SenderVideoConstraintsMessage>()
parsed as SenderVideoConstraintsMessage

parsed.videoConstraints.idealHeight shouldBe 1080
}
Expand All @@ -217,7 +205,6 @@ class BridgeChannelMessageTest : ShouldSpec() {
val parsed = parse(message.toJson())

parsed.shouldBeInstanceOf<AddReceiverMessage>()
parsed as AddReceiverMessage
parsed.bridgeId shouldBe "bridge1"
parsed.endpointId shouldBe "abcdabcd"
parsed.videoConstraints shouldBe VideoConstraints(360)
Expand All @@ -228,7 +215,6 @@ class BridgeChannelMessageTest : ShouldSpec() {
val parsed = parse(message.toJson())

parsed.shouldBeInstanceOf<RemoveReceiverMessage>()
parsed as RemoveReceiverMessage
parsed.bridgeId shouldBe "bridge1"
parsed.endpointId shouldBe "abcdabcd"
}
Expand Down Expand Up @@ -270,7 +256,6 @@ class BridgeChannelMessageTest : ShouldSpec() {
val parsed = parse(RECEIVER_VIDEO_CONSTRAINTS)

parsed.shouldBeInstanceOf<ReceiverVideoConstraintsMessage>()
parsed as ReceiverVideoConstraintsMessage
parsed.lastN shouldBe 3
parsed.onStageEndpoints shouldBe listOf("onstage1", "onstage2")
parsed.selectedEndpoints shouldBe listOf("selected1", "selected2")
Expand All @@ -286,7 +271,6 @@ class BridgeChannelMessageTest : ShouldSpec() {
context("With fields missing") {
val parsed = parse(RECEIVER_VIDEO_CONSTRAINTS_EMPTY)
parsed.shouldBeInstanceOf<ReceiverVideoConstraintsMessage>()
parsed as ReceiverVideoConstraintsMessage
parsed.lastN shouldBe null
parsed.onStageEndpoints shouldBe null
parsed.selectedEndpoints shouldBe null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ class StatsTest : JerseyTest() {
private fun Response.getResultAsJson(): JSONObject {
val obj = JSONParser().parse(readEntity(String::class.java))
obj.shouldBeInstanceOf<JSONObject>()
return obj as JSONObject
return obj
}
}

0 comments on commit 062e9f5

Please sign in to comment.