From 839b2126cddbc3a35e591aa942e61bc0149a2b09 Mon Sep 17 00:00:00 2001 From: Jonathan Lennox Date: Tue, 3 Oct 2023 11:31:28 -0400 Subject: [PATCH] Update for ktlint 1.0.0 (ktlint-maven-plugin 3.0.0). (#1116) --- .editorconfig | 1 + .../main/kotlin/org/jitsi/jicofo/TaskPools.kt | 8 +- .../org/jitsi/jicofo/codec/CodecUtil.kt | 15 ++- .../conference/source/EndpointSourceSet.kt | 32 +++---- .../jicofo/conference/source/SsrcGroup.kt | 5 +- .../main/kotlin/org/jitsi/jicofo/xmpp/Util.kt | 15 ++- .../org/jitsi/jicofo/xmpp/XmppConfig.kt | 24 ++--- .../xmpp/jingle/JingleRequestHandler.kt | 5 +- .../kotlin/org/jitsi/jicofo/bridge/Bridge.kt | 6 +- .../org/jitsi/jicofo/bridge/BridgeConfig.kt | 6 +- .../jicofo/bridge/BridgeSelectionStrategy.kt | 5 +- .../kotlin/org/jitsi/jicofo/bridge/Cascade.kt | 13 +-- .../bridge/SingleMeshTopologyStrategy.kt | 5 +- .../bridge/TopologySelectionStrategy.kt | 5 +- .../jicofo/bridge/VisitorTopologyStrategy.kt | 9 +- .../bridge/colibri/ColibriV2SessionManager.kt | 23 ++--- .../jitsi/jicofo/bridge/BridgeReleaseTest.kt | 90 +++++++++--------- .../jitsi/jicofo/bridge/BridgeSelectorTest.kt | 8 +- .../jicofo/bridge/RegionBasedSelectionTest.kt | 22 ++--- .../org/jitsi/jicofo/ConferenceConfig.kt | 3 +- .../kotlin/org/jitsi/jicofo/FocusManager.kt | 6 +- .../kotlin/org/jitsi/jicofo/JicofoServices.kt | 3 +- .../org/jitsi/jicofo/auth/AuthConfig.kt | 10 +- .../jitsi/jicofo/conference/ConferenceUtil.kt | 5 +- .../jitsi/jicofo/conference/Participant.kt | 12 +-- .../jicofo/conference/SourcesToAddOrRemove.kt | 3 +- .../org/jitsi/jicofo/jibri/BaseJibri.kt | 15 ++- .../org/jitsi/jicofo/jibri/JibriSipGateway.kt | 63 ++++++------- .../org/jitsi/jicofo/xmpp/JigasiIqHandler.kt | 12 +-- .../jicofo/xmpp/muc/ChatRoomRoleManager.kt | 4 +- .../kotlin/org/jitsi/jicofo/DebugStateTest.kt | 4 +- .../jitsi/jicofo/conference/ConferenceTest.kt | 17 ++-- .../source/ConferenceSourceMapTest.kt | 94 +++++++++---------- .../source/EndpointSourceSetTest.kt | 6 +- .../conference/source/SourceSignalingTest.kt | 8 +- .../jitsi/jicofo/jibri/JibriSessionTest.kt | 6 +- .../org/jitsi/jicofo/mock/MockXmppProvider.kt | 3 +- .../jicofo/xmpp/AbstractIqHandlerTest.kt | 4 +- pom.xml | 2 +- 39 files changed, 272 insertions(+), 305 deletions(-) diff --git a/.editorconfig b/.editorconfig index 166a6da87f..dee219d40e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,6 @@ [*.{kt,kts}] max_line_length=120 +ktlint_code_style = intellij_idea # I find trailing commas annoying ktlint_standard_trailing-comma-on-call-site = disabled diff --git a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/TaskPools.kt b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/TaskPools.kt index 11601d9772..b59e60fb88 100644 --- a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/TaskPools.kt +++ b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/TaskPools.kt @@ -32,7 +32,9 @@ class TaskPools { @JvmStatic var ioPool: ExecutorService = defaultIoPool - fun resetIoPool() { ioPool = defaultIoPool } + fun resetIoPool() { + ioPool = defaultIoPool + } private val defaultScheduledPool: ScheduledExecutorService = Executors.newScheduledThreadPool( 3, @@ -42,7 +44,9 @@ class TaskPools { @JvmStatic var scheduledPool: ScheduledExecutorService = defaultScheduledPool - fun resetScheduledPool() { scheduledPool = defaultScheduledPool } + fun resetScheduledPool() { + scheduledPool = defaultScheduledPool + } @JvmStatic fun shutdown() { diff --git a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/codec/CodecUtil.kt b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/codec/CodecUtil.kt index 6508cf28a4..978b3be441 100644 --- a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/codec/CodecUtil.kt +++ b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/codec/CodecUtil.kt @@ -272,15 +272,12 @@ class CodecUtil { } } - private fun createPayloadTypeExtension( - id: Int, - name: String, - clockRate: Int - ) = PayloadTypePacketExtension().apply { - setId(id) - this.name = name - clockrate = clockRate - } + private fun createPayloadTypeExtension(id: Int, name: String, clockRate: Int) = + PayloadTypePacketExtension().apply { + setId(id) + this.name = name + clockrate = clockRate + } fun PayloadTypePacketExtension.addVideoExtensions(options: OfferOptions, codecConfig: CodecConfig) { // a=rtcp-fb:XXX ccm fir diff --git a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/conference/source/EndpointSourceSet.kt b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/conference/source/EndpointSourceSet.kt index 044d5d45ea..a72adc3ba4 100644 --- a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/conference/source/EndpointSourceSet.kt +++ b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/conference/source/EndpointSourceSet.kt @@ -166,9 +166,7 @@ data class EndpointSourceSet( */ @JvmStatic @Throws(IllegalArgumentException::class) - fun fromJingle( - contents: List - ): EndpointSourceSet { + fun fromJingle(contents: List): EndpointSourceSet { val sources = mutableSetOf() val ssrcGroups = mutableSetOf() @@ -237,28 +235,24 @@ private fun ContentPacketExtension.getOrCreateRtpDescription() = this@getOrCreateRtpDescription.addChildExtension(this) } -operator fun EndpointSourceSet?.plus(other: EndpointSourceSet?): EndpointSourceSet = - when { - this == null && other == null -> EndpointSourceSet.EMPTY - this == null -> other!! - other == null -> this - else -> EndpointSourceSet( - sources + other.sources, - ssrcGroups + other.ssrcGroups - ) - } +operator fun EndpointSourceSet?.plus(other: EndpointSourceSet?): EndpointSourceSet = when { + this == null && other == null -> EndpointSourceSet.EMPTY + this == null -> other!! + other == null -> this + else -> EndpointSourceSet( + sources + other.sources, + ssrcGroups + other.ssrcGroups + ) +} operator fun EndpointSourceSet.minus(other: EndpointSourceSet): EndpointSourceSet = EndpointSourceSet(sources - other.sources, ssrcGroups - other.ssrcGroups) -operator fun EndpointSourceSet.plus(sources: Set) = - EndpointSourceSet(this.sources + sources, this.ssrcGroups) +operator fun EndpointSourceSet.plus(sources: Set) = EndpointSourceSet(this.sources + sources, this.ssrcGroups) -operator fun EndpointSourceSet.plus(source: Source) = - EndpointSourceSet(this.sources + source, this.ssrcGroups) +operator fun EndpointSourceSet.plus(source: Source) = EndpointSourceSet(this.sources + source, this.ssrcGroups) -operator fun EndpointSourceSet.plus(ssrcGroup: SsrcGroup) = - EndpointSourceSet(this.sources, this.ssrcGroups + ssrcGroup) +operator fun EndpointSourceSet.plus(ssrcGroup: SsrcGroup) = EndpointSourceSet(this.sources, this.ssrcGroups + ssrcGroup) private fun EndpointSourceSet.doStripSimulcast(): EndpointSourceSet { val groupsToRemove = mutableSetOf() diff --git a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/conference/source/SsrcGroup.kt b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/conference/source/SsrcGroup.kt index 2cf991f37e..dda68ac8fd 100644 --- a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/conference/source/SsrcGroup.kt +++ b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/conference/source/SsrcGroup.kt @@ -49,10 +49,7 @@ data class SsrcGroup( * @throws IllegalArgumentException if the XML extension does not have a valid "semantics" field. */ @Throws(IllegalArgumentException::class) - fun fromPacketExtension( - sgpe: SourceGroupPacketExtension, - mediaType: MediaType = MediaType.VIDEO - ): SsrcGroup { + fun fromPacketExtension(sgpe: SourceGroupPacketExtension, mediaType: MediaType = MediaType.VIDEO): SsrcGroup { val semantics = try { SsrcGroupSemantics.fromString(sgpe.semantics) } catch (e: NoSuchElementException) { diff --git a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/Util.kt b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/Util.kt index ed19068009..026a04e180 100644 --- a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/Util.kt +++ b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/Util.kt @@ -58,14 +58,13 @@ fun parseJidFromClientProxyJid( return jid } -fun XMPPConnection.tryToSendStanza(stanza: Stanza) = - try { - sendStanza(stanza) - } catch (e: SmackException.NotConnectedException) { - logger.error("No connection - unable to send packet: " + stanza.toXML(), e) - } catch (e: InterruptedException) { - logger.error("Failed to send packet: " + stanza.toXML().toString(), e) - } +fun XMPPConnection.tryToSendStanza(stanza: Stanza) = try { + sendStanza(stanza) +} catch (e: SmackException.NotConnectedException) { + logger.error("No connection - unable to send packet: " + stanza.toXML(), e) +} catch (e: InterruptedException) { + logger.error("Failed to send packet: " + stanza.toXML().toString(), e) +} @Throws(SmackException.NotConnectedException::class) fun AbstractXMPPConnection.sendIqAndGetResponse(iq: IQ): IQ? = createStanzaCollectorAndSend(iq).let { diff --git a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppConfig.kt b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppConfig.kt index 8377fd2cd6..f96abcdc2d 100644 --- a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppConfig.kt +++ b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppConfig.kt @@ -149,7 +149,7 @@ class XmppServiceConnectionConfig : XmppConnectionConfig { } } - override val xmppDomain: DomainBareJid? by optionalconfig() { + override val xmppDomain: DomainBareJid? by optionalconfig { "jicofo.xmpp.service.xmpp-domain".from(newConfig) } @@ -193,12 +193,12 @@ class XmppServiceConnectionConfig : XmppConnectionConfig { class XmppClientConnectionConfig : XmppConnectionConfig { override val enabled: Boolean by config { - legacyHostnamePropertyName.from(legacyConfig).convertFrom { true } + LEGACY_HOSTNAME_PROPERTY_NAME.from(legacyConfig).convertFrom { true } "jicofo.xmpp.client.enabled".from(newConfig) } override val hostname: String by config { - legacyHostnamePropertyName.from(legacyConfig) + LEGACY_HOSTNAME_PROPERTY_NAME.from(legacyConfig) "jicofo.xmpp.client.hostname".from(newConfig) } @@ -211,7 +211,7 @@ class XmppClientConnectionConfig : XmppConnectionConfig { * This is the domain used for login. Not necessarily the root XMPP domain. */ override val domain: DomainBareJid by config { - legacyDomainPropertyName.from(legacyConfig).convertFrom { + LEGACY_DOMAIN_PROPERTY_NAME.from(legacyConfig).convertFrom { JidCreate.domainBareFrom(it) } "jicofo.xmpp.client.domain".from(newConfig).convertFrom { @@ -220,7 +220,7 @@ class XmppClientConnectionConfig : XmppConnectionConfig { } override val username: Resourcepart by config { - legacyUsernamePropertyName.from(legacyConfig).convertFrom { + LEGACY_USERNAME_PROPERTY_NAME.from(legacyConfig).convertFrom { Resourcepart.from(it) } "jicofo.xmpp.client.username".from(newConfig).convertFrom { @@ -235,7 +235,7 @@ class XmppClientConnectionConfig : XmppConnectionConfig { } override val password: String? by optionalconfig { - legacyPasswordPropertyName.from(legacyConfig) + LEGACY_PASSWORD_PROPERTY_NAME.from(legacyConfig) "jicofo.xmpp.client.password".from(newConfig) } @@ -243,7 +243,7 @@ class XmppClientConnectionConfig : XmppConnectionConfig { * This is the top-level domain hosted by the XMPP server (not necessarily the one used for login). */ override val xmppDomain: DomainBareJid by config { - legacyXmppDomainPropertyName.from(legacyConfig).convertFrom { + LEGACY_XMPP_DOMAIN_PROPERTY_NAME.from(legacyConfig).convertFrom { JidCreate.domainBareFrom(it) } "jicofo.xmpp.client.xmpp-domain".from(newConfig).convertFrom { @@ -285,10 +285,10 @@ class XmppClientConnectionConfig : XmppConnectionConfig { override val name = "client" companion object { - const val legacyHostnamePropertyName = "org.jitsi.jicofo.HOSTNAME" - const val legacyDomainPropertyName = "org.jitsi.jicofo.FOCUS_USER_DOMAIN" - const val legacyUsernamePropertyName = "org.jitsi.jicofo.FOCUS_USER_NAME" - const val legacyPasswordPropertyName = "org.jitsi.jicofo.FOCUS_USER_PASSWORD" - const val legacyXmppDomainPropertyName = "org.jitsi.jicofo.XMPP_DOMAIN" + const val LEGACY_HOSTNAME_PROPERTY_NAME = "org.jitsi.jicofo.HOSTNAME" + const val LEGACY_DOMAIN_PROPERTY_NAME = "org.jitsi.jicofo.FOCUS_USER_DOMAIN" + const val LEGACY_USERNAME_PROPERTY_NAME = "org.jitsi.jicofo.FOCUS_USER_NAME" + const val LEGACY_PASSWORD_PROPERTY_NAME = "org.jitsi.jicofo.FOCUS_USER_PASSWORD" + const val LEGACY_XMPP_DOMAIN_PROPERTY_NAME = "org.jitsi.jicofo.XMPP_DOMAIN" } } diff --git a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/jingle/JingleRequestHandler.kt b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/jingle/JingleRequestHandler.kt index 9fba4c02e8..ce8013a3b1 100644 --- a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/jingle/JingleRequestHandler.kt +++ b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/jingle/JingleRequestHandler.kt @@ -78,10 +78,7 @@ interface JingleRequestHandler { * @return a [StanzaError] if an error should be returned as response to the original request or null if * processing was successful. */ - fun onTransportAccept( - jingleSession: JingleSession, - contents: List - ): StanzaError? = null + fun onTransportAccept(jingleSession: JingleSession, contents: List): StanzaError? = null /** * A 'transport-reject' IQ was received. diff --git a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/Bridge.kt b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/Bridge.kt index ea0f07afd0..987c6dff53 100644 --- a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/Bridge.kt +++ b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/Bridge.kt @@ -337,7 +337,11 @@ class Bridge @JvmOverloads internal constructor( } private fun getPriority(b: Bridge): Int { - return if (b.isOperational) { if (b.isInGracefulShutdown) 2 else 1 } else 3 + return if (b.isOperational) { + if (b.isInGracefulShutdown) 2 else 1 + } else { + 3 + } } } } diff --git a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/BridgeConfig.kt b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/BridgeConfig.kt index d065f7ab2e..6ee6222239 100644 --- a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/BridgeConfig.kt +++ b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/BridgeConfig.kt @@ -103,11 +103,9 @@ class BridgeConfig private constructor() { } } - private fun createSelectionStrategy(className: String): BridgeSelectionStrategy = - createClassInstance(className) + private fun createSelectionStrategy(className: String): BridgeSelectionStrategy = createClassInstance(className) - private fun createTopologyStrategy(className: String): TopologySelectionStrategy = - createClassInstance(className) + private fun createTopologyStrategy(className: String): TopologySelectionStrategy = createClassInstance(className) val healthChecksEnabled: Boolean by config { "org.jitsi.jicofo.HEALTH_CHECK_INTERVAL".from(JitsiConfig.legacyConfig) diff --git a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/BridgeSelectionStrategy.kt b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/BridgeSelectionStrategy.kt index 255bbae720..6c2155d861 100644 --- a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/BridgeSelectionStrategy.kt +++ b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/BridgeSelectionStrategy.kt @@ -399,10 +399,7 @@ abstract class BridgeSelectionStrategy { * @param conferenceBridges the bridges in the conference * @return `true` if the bridge should be considered overloaded. */ - private fun isOverloaded( - bridge: Bridge, - conferenceBridges: Map - ): Boolean { + private fun isOverloaded(bridge: Bridge, conferenceBridges: Map): Boolean { return bridge.isOverloaded || ( maxParticipantsPerBridge > 0 && conferenceBridges.containsKey(bridge) && diff --git a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/Cascade.kt b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/Cascade.kt index 57f0fb0625..dc781b87f8 100644 --- a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/Cascade.kt +++ b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/Cascade.kt @@ -51,8 +51,7 @@ data class CascadeRepair, L : CascadeLink>( val meshId: String ) -fun , L : CascadeLink> Cascade.containsNode(node: N) = - sessions[node.relayId] === node +fun , L : CascadeLink> Cascade.containsNode(node: N) = sessions[node.relayId] === node fun , L : CascadeLink> N.hasMesh(meshId: String?): Boolean = relays.values.any { it.meshId == meshId } @@ -191,10 +190,7 @@ private fun , L : CascadeLink> Cascade.getNodesBehin } /* Traverse the graph from a node; for each other node, indicate the node from which it was reached. */ -fun , N : CascadeNode, L : CascadeLink> C.getPathsFrom( - node: N, - pathFn: (C, N, N?) -> Unit -) { +fun , N : CascadeNode, L : CascadeLink> C.getPathsFrom(node: N, pathFn: (C, N, N?) -> Unit) { pathFn(this, node, null) node.relays.values.forEach { getPathsFrom(it, node, pathFn) @@ -317,10 +313,7 @@ fun , L : CascadeLink> Cascade.getDistanceFrom(node: return Int.MAX_VALUE } -private fun , L : CascadeLink> Cascade.getDistanceFrom( - link: L, - pred: (N) -> Boolean -): Int { +private fun , L : CascadeLink> Cascade.getDistanceFrom(link: L, pred: (N) -> Boolean): Int { val node = checkNotNull(sessions[link.relayId]) if (pred(node)) return 0 diff --git a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/SingleMeshTopologyStrategy.kt b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/SingleMeshTopologyStrategy.kt index 5e83f9f9fa..8d7e58de8a 100644 --- a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/SingleMeshTopologyStrategy.kt +++ b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/SingleMeshTopologyStrategy.kt @@ -21,10 +21,7 @@ import org.jitsi.jicofo.bridge.colibri.ColibriV2SessionManager /** Put all bridge nodes into a single mesh, named "0". */ class SingleMeshTopologyStrategy : TopologySelectionStrategy() { - override fun connectNode( - cascade: ColibriV2SessionManager, - node: Colibri2Session - ): TopologySelectionResult = + override fun connectNode(cascade: ColibriV2SessionManager, node: Colibri2Session): TopologySelectionResult = TopologySelectionResult(cascade.sessions.values.firstOrNull(), "0") override fun repairMesh( diff --git a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/TopologySelectionStrategy.kt b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/TopologySelectionStrategy.kt index e61ef096c2..cc9953f97a 100644 --- a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/TopologySelectionStrategy.kt +++ b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/TopologySelectionStrategy.kt @@ -23,10 +23,7 @@ import org.jitsi.jicofo.bridge.colibri.ColibriV2SessionManager * Represents a strategy for selecting bridge topologies. */ abstract class TopologySelectionStrategy { - abstract fun connectNode( - cascade: ColibriV2SessionManager, - node: Colibri2Session - ): TopologySelectionResult + abstract fun connectNode(cascade: ColibriV2SessionManager, node: Colibri2Session): TopologySelectionResult abstract fun repairMesh( cascade: ColibriV2SessionManager, disconnected: Set> diff --git a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/VisitorTopologyStrategy.kt b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/VisitorTopologyStrategy.kt index 96b8765e19..785cf2623a 100644 --- a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/VisitorTopologyStrategy.kt +++ b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/VisitorTopologyStrategy.kt @@ -53,13 +53,10 @@ class VisitorTopologyStrategy : TopologySelectionStrategy() { ?: existingNodes.first() } - override fun connectNode( - cascade: ColibriV2SessionManager, - node: Colibri2Session - ): TopologySelectionResult { + override fun connectNode(cascade: ColibriV2SessionManager, node: Colibri2Session): TopologySelectionResult { val existingNodes = cascade.sessions.values if (!node.visitor) { - return TopologySelectionResult(existingNodes.firstOrNull(), coreMesh) + return TopologySelectionResult(existingNodes.firstOrNull(), CORE_MESH) } if (existingNodes.isEmpty()) { @@ -96,6 +93,6 @@ class VisitorTopologyStrategy : TopologySelectionStrategy() { } companion object { - private const val coreMesh = "0" + private const val CORE_MESH = "0" } } diff --git a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/colibri/ColibriV2SessionManager.kt b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/colibri/ColibriV2SessionManager.kt index 8d462d1cde..c25a2005cc 100644 --- a/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/colibri/ColibriV2SessionManager.kt +++ b/jicofo-selector/src/main/kotlin/org/jitsi/jicofo/bridge/colibri/ColibriV2SessionManager.kt @@ -142,8 +142,9 @@ class ColibriV2SessionManager( return participants.toSet() } - private fun removeParticipantInfosBySession(bySession: Map>): - Set { + private fun removeParticipantInfosBySession( + bySession: Map> + ): Set { var sessionRemoved = false val participantsRemoved = mutableSetOf() bySession.forEach { (session, sessionParticipantsToRemove) -> @@ -229,16 +230,16 @@ class ColibriV2SessionManager( * Get the [Colibri2Session] for a specific [Bridge]. If one doesn't exist, create it. Returns the session and * a boolean indicating whether the session was just created (true) or existed (false). */ - private fun getOrCreateSession(bridge: Bridge, visitor: Boolean): - Pair = synchronized(syncRoot) { - var session = sessions[bridge.relayId] - if (session != null) { - return Pair(session, false) - } + private fun getOrCreateSession(bridge: Bridge, visitor: Boolean): Pair = + synchronized(syncRoot) { + var session = sessions[bridge.relayId] + if (session != null) { + return Pair(session, false) + } - session = Colibri2Session(this, bridge, visitor, logger) - return Pair(session, true) - } + session = Colibri2Session(this, bridge, visitor, logger) + return Pair(session, true) + } /** Get the bridge-to-bridge-properties map needed for bridge selection. */ private fun getBridges(): Map = synchronized(syncRoot) { diff --git a/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/BridgeReleaseTest.kt b/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/BridgeReleaseTest.kt index 22dbeebddc..b36b1115eb 100644 --- a/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/BridgeReleaseTest.kt +++ b/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/BridgeReleaseTest.kt @@ -44,23 +44,23 @@ class BridgeReleaseTest : ShouldSpec() { setNewConfig( """ $regionBasedConfig - jicofo.bridge.max-bridge-participants=$maxBp + jicofo.bridge.max-bridge-participants=$MAX_BP """.trimIndent(), true ) - BridgeConfig.config.maxBridgeParticipants shouldBe maxBp + BridgeConfig.config.maxBridgeParticipants shouldBe MAX_BP val selector = BridgeSelector(clock) // We start with bridges from a single "old" release. - val old1 = selector.createBridge("old1", oldVersion, 0.1) - val old2 = selector.createBridge("old2", oldVersion, 0.2) - val old3 = selector.createBridge("old3", oldVersion, 0.3) + val old1 = selector.createBridge("old1", OLD_VERSION, 0.1) + val old2 = selector.createBridge("old2", OLD_VERSION, 0.2) + val old3 = selector.createBridge("old3", OLD_VERSION, 0.3) // Initially we only have bridges from the "old" release. Verify the basics. // Select the least loaded bridge selector.testSelect() shouldBe old1 - selector.testSelect(version = oldVersion) shouldBe old1 + selector.testSelect(version = OLD_VERSION) shouldBe old1 selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(1))) shouldBe old1 // Select an existing conference bridge selector.testSelect(mapOf(old2 to ConferenceBridgeProperties(1))) shouldBe old2 @@ -74,75 +74,75 @@ class BridgeReleaseTest : ShouldSpec() { // Fail if the version doesn't match selector.testSelect(version = "invalid-version") shouldBe null // Fail with inconsistent version pinning - selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(1)), version = newVersion) shouldBe null + selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(1)), version = NEW_VERSION) shouldBe null // Honor max-participants-per-bridge - selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(maxBp))) shouldBe old2 + selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(MAX_BP))) shouldBe old2 selector.testSelect( mapOf( - old1 to ConferenceBridgeProperties(maxBp), + old1 to ConferenceBridgeProperties(MAX_BP), old3 to ConferenceBridgeProperties(1) ) ) shouldBe old3 selector.testSelect( mapOf( - old1 to ConferenceBridgeProperties(maxBp), - old3 to ConferenceBridgeProperties(maxBp) + old1 to ConferenceBridgeProperties(MAX_BP), + old3 to ConferenceBridgeProperties(MAX_BP) ) ) shouldBe old2 // Select the least loaded if all are full selector.testSelect( mapOf( - old1 to ConferenceBridgeProperties(maxBp), - old2 to ConferenceBridgeProperties(maxBp), - old3 to ConferenceBridgeProperties(maxBp) + old1 to ConferenceBridgeProperties(MAX_BP), + old2 to ConferenceBridgeProperties(MAX_BP), + old3 to ConferenceBridgeProperties(MAX_BP) ) ) shouldBe old1 // We add a new bridge with a new release. - val new1 = selector.createBridge("new1", newVersion, 0.0, drain = true) + val new1 = selector.createBridge("new1", NEW_VERSION, 0.0, drain = true) // An old one should be used even though the new one has stress 0, because the new one is drained. selector.testSelect() shouldBe old1 - selector.testSelect(version = newVersion) shouldBe new1 + selector.testSelect(version = NEW_VERSION) shouldBe new1 selector.testSelect(mapOf(new1 to ConferenceBridgeProperties(1))) shouldBe new1 new1.setStats(stress = 0.3, drain = true) // And more bridges with a new release. - val new2 = selector.createBridge("new2", newVersion, 0.2, drain = true) - val new3 = selector.createBridge("new3", newVersion, 0.1, drain = true) - selector.testSelect(version = newVersion) shouldBe new3 + val new2 = selector.createBridge("new2", NEW_VERSION, 0.2, drain = true) + val new3 = selector.createBridge("new3", NEW_VERSION, 0.1, drain = true) + selector.testSelect(version = NEW_VERSION) shouldBe new3 selector.testSelect(mapOf(new2 to ConferenceBridgeProperties(1))) shouldBe new2 selector.testSelect(mapOf(new1 to ConferenceBridgeProperties(1))) shouldBe new1 - selector.testSelect(mapOf(new1 to ConferenceBridgeProperties(1)), version = newVersion) shouldBe new1 + selector.testSelect(mapOf(new1 to ConferenceBridgeProperties(1)), version = NEW_VERSION) shouldBe new1 selector.testSelect(mapOf(new2 to ConferenceBridgeProperties(1))) shouldBe new2 - selector.testSelect(mapOf(new2 to ConferenceBridgeProperties(1)), version = newVersion) shouldBe new2 + selector.testSelect(mapOf(new2 to ConferenceBridgeProperties(1)), version = NEW_VERSION) shouldBe new2 selector.testSelect(mapOf(new3 to ConferenceBridgeProperties(1))) shouldBe new3 - selector.testSelect(mapOf(new3 to ConferenceBridgeProperties(1)), version = newVersion) shouldBe new3 - selector.testSelect(mapOf(new1 to ConferenceBridgeProperties(1)), version = oldVersion) shouldBe null + selector.testSelect(mapOf(new3 to ConferenceBridgeProperties(1)), version = NEW_VERSION) shouldBe new3 + selector.testSelect(mapOf(new1 to ConferenceBridgeProperties(1)), version = OLD_VERSION) shouldBe null // Honor max-participants-per-bridge, even though all new bridges are in drain. - selector.testSelect(mapOf(new1 to ConferenceBridgeProperties(maxBp))) shouldBe new3 + selector.testSelect(mapOf(new1 to ConferenceBridgeProperties(MAX_BP))) shouldBe new3 selector.testSelect( mapOf( - new1 to ConferenceBridgeProperties(maxBp), + new1 to ConferenceBridgeProperties(MAX_BP), new2 to ConferenceBridgeProperties(1) ) ) shouldBe new2 selector.testSelect( mapOf( - new1 to ConferenceBridgeProperties(maxBp), - new2 to ConferenceBridgeProperties(maxBp) + new1 to ConferenceBridgeProperties(MAX_BP), + new2 to ConferenceBridgeProperties(MAX_BP) ) ) shouldBe new3 selector.testSelect( mapOf( - new1 to ConferenceBridgeProperties(maxBp), - new2 to ConferenceBridgeProperties(maxBp), - new3 to ConferenceBridgeProperties(maxBp) + new1 to ConferenceBridgeProperties(MAX_BP), + new2 to ConferenceBridgeProperties(MAX_BP), + new3 to ConferenceBridgeProperties(MAX_BP) ) ) shouldBe new3 // Everything should work the same unless a conference is pinned to the new version. // Select the least loaded bridge selector.testSelect() shouldBe old1 - selector.testSelect(version = oldVersion) shouldBe old1 + selector.testSelect(version = OLD_VERSION) shouldBe old1 selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(1))) shouldBe old1 // Select an existing conference bridge selector.testSelect(mapOf(old2 to ConferenceBridgeProperties(1))) shouldBe old2 @@ -156,26 +156,26 @@ class BridgeReleaseTest : ShouldSpec() { // Fail if the version doesn't match selector.testSelect(version = "invalid-version") shouldBe null // Fail with inconsistent version pinning - selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(1)), version = newVersion) shouldBe null + selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(1)), version = NEW_VERSION) shouldBe null // Honor max-participants-per-bridge - selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(maxBp))) shouldBe old2 + selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(MAX_BP))) shouldBe old2 selector.testSelect( mapOf( - old1 to ConferenceBridgeProperties(maxBp), + old1 to ConferenceBridgeProperties(MAX_BP), old3 to ConferenceBridgeProperties(1) ) ) shouldBe old3 selector.testSelect( mapOf( - old1 to ConferenceBridgeProperties(maxBp), - old3 to ConferenceBridgeProperties(maxBp) + old1 to ConferenceBridgeProperties(MAX_BP), + old3 to ConferenceBridgeProperties(MAX_BP) ) ) shouldBe old2 selector.testSelect( mapOf( - old1 to ConferenceBridgeProperties(maxBp), - old2 to ConferenceBridgeProperties(maxBp), - old3 to ConferenceBridgeProperties(maxBp) + old1 to ConferenceBridgeProperties(MAX_BP), + old2 to ConferenceBridgeProperties(MAX_BP), + old3 to ConferenceBridgeProperties(MAX_BP) ) ) shouldBe old1 @@ -187,12 +187,12 @@ class BridgeReleaseTest : ShouldSpec() { old1.setStats(stress = 0.0, drain = true) // old1 should not be selected because it is in drain selector.testSelect() shouldBe new3 - selector.testSelect(mapOf(new3 to ConferenceBridgeProperties(maxBp))) shouldBe new2 + selector.testSelect(mapOf(new3 to ConferenceBridgeProperties(MAX_BP))) shouldBe new2 // Select the old version for existing conferences or pinned selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(1))) shouldBe old1 // Should select old2 even though all old bridges are in drain. - selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(maxBp))) shouldBe old2 - selector.testSelect(version = oldVersion) shouldBe old1 + selector.testSelect(mapOf(old1 to ConferenceBridgeProperties(MAX_BP))) shouldBe old2 + selector.testSelect(version = OLD_VERSION) shouldBe old1 } } } @@ -208,9 +208,9 @@ private fun BridgeSelector.createBridge(jid: String, version: String, stress: Do ) } -private val maxBp = 80 -private const val oldVersion = "old" -private const val newVersion = "new" +private const val MAX_BP = 80 +private const val OLD_VERSION = "old" +private const val NEW_VERSION = "new" private fun BridgeSelector.testSelect( conferenceBridges: Map = emptyMap(), diff --git a/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/BridgeSelectorTest.kt b/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/BridgeSelectorTest.kt index f34e41896f..d4ddfe82d4 100644 --- a/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/BridgeSelectorTest.kt +++ b/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/BridgeSelectorTest.kt @@ -271,17 +271,17 @@ class BridgeSelectorTest : ShouldSpec() { } } -private const val enableOctoConfig = "jicofo.octo.enabled=true" +private const val ENABLE_OCTO_CONFIG = "jicofo.octo.enabled=true" val regionBasedConfig = """ - $enableOctoConfig + $ENABLE_OCTO_CONFIG jicofo.bridge.selection-strategy=RegionBasedBridgeSelectionStrategy """.trimIndent() private val splitConfig = """ - $enableOctoConfig + $ENABLE_OCTO_CONFIG jicofo.bridge.selection-strategy=SplitBridgeSelectionStrategy """.trimIndent() private val visitorConfig = """ - $enableOctoConfig + $ENABLE_OCTO_CONFIG jicofo.bridge.selection-strategy=VisitorSelectionStrategy jicofo.bridge.visitor-selection-strategy=SingleBridgeSelectionStrategy jicofo.bridge.participant-selection-strategy=SingleBridgeSelectionStrategy diff --git a/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/RegionBasedSelectionTest.kt b/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/RegionBasedSelectionTest.kt index d59539e630..728ca6d7e3 100644 --- a/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/RegionBasedSelectionTest.kt +++ b/jicofo-selector/src/test/kotlin/org/jitsi/jicofo/bridge/RegionBasedSelectionTest.kt @@ -43,8 +43,8 @@ class RegionBasedSelectionTest : ShouldSpec() { init { context("Without region groups") { - withNewConfig(maxBpConfig) { - BridgeConfig.config.maxBridgeParticipants shouldBe maxBp + withNewConfig(MAX_BP_CONFIG) { + BridgeConfig.config.maxBridgeParticipants shouldBe MAX_BP with(RegionBasedBridgeSelectionStrategy()) { context("In a single region") { @@ -56,11 +56,11 @@ class RegionBasedSelectionTest : ShouldSpec() { ) shouldBe bridges[ApSouth][Medium] select( participantRegion = ApSouth, - conferenceBridges = mapOf(bridges[ApSouth][Medium] to ConferenceBridgeProperties(maxBp)) + conferenceBridges = mapOf(bridges[ApSouth][Medium] to ConferenceBridgeProperties(MAX_BP)) ) shouldBe bridges[ApSouth][Low] select( participantRegion = ApSouth, - conferenceBridges = mapOf(bridges[ApSouth][Low] to ConferenceBridgeProperties(maxBp)) + conferenceBridges = mapOf(bridges[ApSouth][Low] to ConferenceBridgeProperties(MAX_BP)) ) shouldBe bridges[ApSouth][Medium] select( participantRegion = ApSouth, @@ -106,7 +106,7 @@ class RegionBasedSelectionTest : ShouldSpec() { bridges[ApSouth][Low] to ConferenceBridgeProperties(2), bridges[EuWest][Medium] to ConferenceBridgeProperties(1), bridges[EuWest][High] to ConferenceBridgeProperties(1), - bridges[EuCentral][Low] to ConferenceBridgeProperties(maxBp) + bridges[EuCentral][Low] to ConferenceBridgeProperties(MAX_BP) ) ) shouldBe bridges[EuCentral][Medium] } @@ -115,7 +115,7 @@ class RegionBasedSelectionTest : ShouldSpec() { } context("With region groups") { withNewConfig(regionGroupsConfig) { - BridgeConfig.config.maxBridgeParticipants shouldBe maxBp + BridgeConfig.config.maxBridgeParticipants shouldBe MAX_BP with(RegionBasedBridgeSelectionStrategy()) { select(participantRegion = ApSouth) shouldBe bridges[ApSouth][Low] @@ -140,7 +140,7 @@ class RegionBasedSelectionTest : ShouldSpec() { bridges[ApSouth][Low] to ConferenceBridgeProperties(2), bridges[EuWest][Medium] to ConferenceBridgeProperties(1), bridges[EuWest][High] to ConferenceBridgeProperties(1), - bridges[EuCentral][Low] to ConferenceBridgeProperties(maxBp) + bridges[EuCentral][Low] to ConferenceBridgeProperties(MAX_BP) ) ) shouldBe bridges[EuWest][Medium] select( @@ -149,7 +149,7 @@ class RegionBasedSelectionTest : ShouldSpec() { bridges[ApSouth][Low] to ConferenceBridgeProperties(2), bridges[EuWest][Medium] to ConferenceBridgeProperties(1), bridges[EuWest][High] to ConferenceBridgeProperties(1), - bridges[EuCentral][Low] to ConferenceBridgeProperties(maxBp) + bridges[EuCentral][Low] to ConferenceBridgeProperties(MAX_BP) ) ) shouldBe bridges[UsEast][Low] context("Initial selection in the local region group, but not in the local region") { @@ -161,8 +161,8 @@ class RegionBasedSelectionTest : ShouldSpec() { } } -private const val maxBp = 10 -const val maxBpConfig = "jicofo.bridge.max-bridge-participants=$maxBp" +private const val MAX_BP = 10 +const val MAX_BP_CONFIG = "jicofo.bridge.max-bridge-participants=$MAX_BP" val regionGroupsConfig = """ jicofo.local-region = ${UsEast.region} jicofo.bridge.selection-strategy=RegionBasedBridgeSelectionStrategy @@ -170,7 +170,7 @@ val regionGroupsConfig = """ [ "${UsEast.region}", "${UsWest.region}" ], [ "${EuCentral.region}", "${EuWest.region}" ], ] - $maxBpConfig + $MAX_BP_CONFIG """.trimIndent() private fun mockBridge(r: Regions, s: StressLevels) = mockk { diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/ConferenceConfig.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/ConferenceConfig.kt index dd948222f1..b60f11a989 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/ConferenceConfig.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/ConferenceConfig.kt @@ -99,8 +99,7 @@ class ConferenceConfig private constructor() { /** * Get the number of milliseconds to delay signaling of Jingle sources given a certain [conferenceSize]. */ - fun getSourceSignalingDelayMs(conferenceSize: Int) = - sourceSignalingDelays.floorEntry(conferenceSize)?.value ?: 0 + fun getSourceSignalingDelayMs(conferenceSize: Int) = sourceSignalingDelays.floorEntry(conferenceSize)?.value ?: 0 val reinviteMethod: ReinviteMethod by config { "jicofo.conference.reinvite-method".from(newConfig) diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/FocusManager.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/FocusManager.kt index 08c35621af..ed711e8e6f 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/FocusManager.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/FocusManager.kt @@ -304,11 +304,7 @@ class FocusManager( } /** Create or update the pinning for the specified conference. */ - fun pinConference( - roomName: EntityBareJid, - jvbVersion: String, - duration: Duration - ) { + fun pinConference(roomName: EntityBareJid, jvbVersion: String, duration: Duration) { val pc = PinnedConference(jvbVersion, duration) synchronized(conferencesSyncRoot) { val prev = pinnedConferences.remove(roomName) diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/JicofoServices.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/JicofoServices.kt index ee0fc3db40..5545b433c4 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/JicofoServices.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/JicofoServices.kt @@ -72,7 +72,8 @@ class JicofoServices { val xmppServices = XmppServices( conferenceStore = focusManager, - focusManager = focusManager, // TODO do not use FocusManager directly + // TODO do not use FocusManager directly + focusManager = focusManager, authenticationAuthority = authenticationAuthority ).also { it.clientConnection.addListener(focusManager) diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/auth/AuthConfig.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/auth/AuthConfig.kt index 11f81ca8ed..689483b479 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/auth/AuthConfig.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/auth/AuthConfig.kt @@ -26,16 +26,16 @@ import java.time.Duration class AuthConfig private constructor() { private val enabled: Boolean by config { // Enabled if the URL is set to anything - legacyLoginUrlPropertyName.from(legacyConfig).convertFrom { true } + LEGACY_LOGIN_URL_PROPERTY_NAME.from(legacyConfig).convertFrom { true } // Read the legacy key from newConfig in case it was set as a System property. - legacyLoginUrlPropertyName.from(newConfig).convertFrom { true } + LEGACY_LOGIN_URL_PROPERTY_NAME.from(newConfig).convertFrom { true } "jicofo.authentication.enabled".from(newConfig) } val loginUrl: String by config { - legacyLoginUrlPropertyName.from(legacyConfig).convertFrom { it.stripType() } + LEGACY_LOGIN_URL_PROPERTY_NAME.from(legacyConfig).convertFrom { it.stripType() } // Read the legacy key from newConfig in case it was set as a System property. - legacyLoginUrlPropertyName.from(newConfig).convertFrom { it.stripType() } + LEGACY_LOGIN_URL_PROPERTY_NAME.from(newConfig).convertFrom { it.stripType() } "jicofo.authentication.login-url".from(newConfig) } @@ -74,7 +74,7 @@ class AuthConfig private constructor() { @JvmField val config = AuthConfig() - const val legacyLoginUrlPropertyName = "org.jitsi.jicofo.auth.URL" + const val LEGACY_LOGIN_URL_PROPERTY_NAME = "org.jitsi.jicofo.auth.URL" } enum class Type { diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/ConferenceUtil.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/ConferenceUtil.kt index ebc7539b28..da87be7d62 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/ConferenceUtil.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/ConferenceUtil.kt @@ -59,10 +59,7 @@ internal fun List.getTransport(): IceUdpTransportPacketE return transport } -internal fun selectVisitorNode( - existingNodes: Map, - allNodes: List -): String? { +internal fun selectVisitorNode(existingNodes: Map, allNodes: List): String? { val min = existingNodes.minByOrNull { it.value.visitorCount } if (min != null && min.value.visitorCount < VisitorsConfig.config.maxVisitorsPerNode) { return min.key diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/Participant.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/Participant.kt index 4a65a02ec4..f6e9afeeaf 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/Participant.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/Participant.kt @@ -456,10 +456,8 @@ open class Participant @JvmOverloads constructor( return null } - override fun onSessionAccept( - jingleSession: JingleSession, - contents: List - ) = onSessionOrTransportAccept(jingleSession, contents, JingleAction.SESSION_ACCEPT) + override fun onSessionAccept(jingleSession: JingleSession, contents: List) = + onSessionOrTransportAccept(jingleSession, contents, JingleAction.SESSION_ACCEPT) private fun onSessionOrTransportAccept( jingleSession: JingleSession, @@ -560,10 +558,8 @@ open class Participant @JvmOverloads constructor( return null } - override fun onTransportAccept( - jingleSession: JingleSession, - contents: List - ) = onSessionOrTransportAccept(jingleSession, contents, JingleAction.TRANSPORT_ACCEPT) + override fun onTransportAccept(jingleSession: JingleSession, contents: List) = + onSessionOrTransportAccept(jingleSession, contents, JingleAction.TRANSPORT_ACCEPT) override fun onTransportReject(jingleSession: JingleSession, iq: JingleIQ) { checkJingleSession(jingleSession)?.let { return } diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/SourcesToAddOrRemove.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/SourcesToAddOrRemove.kt index e70f0eba4c..b87bd1c33f 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/SourcesToAddOrRemove.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/conference/SourcesToAddOrRemove.kt @@ -22,7 +22,8 @@ import org.jitsi.utils.OrderedJsonObject /** An action -- add or remove. */ enum class AddOrRemove { - Add, Remove + Add, + Remove } /** Holds a [ConferenceSourceMap] together with an action specifying if the sources are to be added or removed. */ diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/jibri/BaseJibri.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/jibri/BaseJibri.kt index 551239d379..75cdb06ee9 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/jibri/BaseJibri.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/jibri/BaseJibri.kt @@ -70,14 +70,13 @@ abstract class BaseJibri internal constructor( protected val logger: Logger = parentLogger.createChildLogger(BaseJibri::class.simpleName) - fun handleJibriRequest(request: JibriRequest): IqProcessingResult = - if (accept(request.iq)) { - logger.info("Accepted jibri request: ${request.iq.toXML()}") - incomingIqQueue.add(request) - AcceptedWithNoResponse() - } else { - NotProcessed() - } + fun handleJibriRequest(request: JibriRequest): IqProcessingResult = if (accept(request.iq)) { + logger.info("Accepted jibri request: ${request.iq.toXML()}") + incomingIqQueue.add(request) + AcceptedWithNoResponse() + } else { + NotProcessed() + } /** * Returns the [JibriSession] associated with a specific [JibriIq] coming from a client in the conference. diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/jibri/JibriSipGateway.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/jibri/JibriSipGateway.kt index d7812ad610..e33315818d 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/jibri/JibriSipGateway.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/jibri/JibriSipGateway.kt @@ -70,40 +70,39 @@ class JibriSipGateway( override val jibriSessions: List get() = ArrayList(sipSessions.values) - override fun handleStartRequest(iq: JibriIq): IQ = - if (StringUtils.isNotBlank(iq.sipAddress)) { - val sessionId = generateSessionId() - val jibriSession = JibriSession( - this, - conference.roomName, - iq.from, - config.pendingTimeout.seconds, - config.numRetries, - jibriDetector, - false, - iq.sipAddress, - iq.displayName, null, null, sessionId, null, - logger - ) - sipSessions[iq.sipAddress] = jibriSession - try { - jibriSession.start() - logger.info("Started Jibri session") - JibriIq.createResult(iq, sessionId) - } catch (exc: StartException) { - val reason = exc.message - logger.warn("Failed to start a Jibri session: $reason", exc) - sipSessions.remove(iq.sipAddress) - when (exc) { - is AllBusy -> error(iq, StanzaError.Condition.resource_constraint, "all Jibris are busy") - is NotAvailable -> error(iq, StanzaError.Condition.service_unavailable, "no Jibris available") - else -> error(iq, StanzaError.Condition.internal_server_error, reason) - } + override fun handleStartRequest(iq: JibriIq): IQ = if (StringUtils.isNotBlank(iq.sipAddress)) { + val sessionId = generateSessionId() + val jibriSession = JibriSession( + this, + conference.roomName, + iq.from, + config.pendingTimeout.seconds, + config.numRetries, + jibriDetector, + false, + iq.sipAddress, + iq.displayName, null, null, sessionId, null, + logger + ) + sipSessions[iq.sipAddress] = jibriSession + try { + jibriSession.start() + logger.info("Started Jibri session") + JibriIq.createResult(iq, sessionId) + } catch (exc: StartException) { + val reason = exc.message + logger.warn("Failed to start a Jibri session: $reason", exc) + sipSessions.remove(iq.sipAddress) + when (exc) { + is AllBusy -> error(iq, StanzaError.Condition.resource_constraint, "all Jibris are busy") + is NotAvailable -> error(iq, StanzaError.Condition.service_unavailable, "no Jibris available") + else -> error(iq, StanzaError.Condition.internal_server_error, reason) } - } else { - // Bad request - no SIP address - error(iq, StanzaError.Condition.bad_request, "Stream ID is empty or undefined") } + } else { + // Bad request - no SIP address + error(iq, StanzaError.Condition.bad_request, "Stream ID is empty or undefined") + } override fun onSessionStateChanged( jibriSession: JibriSession, diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/JigasiIqHandler.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/JigasiIqHandler.kt index 22fb453a1a..c03ba49048 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/JigasiIqHandler.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/JigasiIqHandler.kt @@ -193,25 +193,25 @@ class JigasiIqHandler( } companion object { - private const val prefix = "jigasi_iq_handler" + private const val PREFIX = "jigasi_iq_handler" val rejectedRequests = JicofoMetricsContainer.instance.registerCounter( - "${prefix}_rejected_requests", + "${PREFIX}_rejected_requests", "User requests which were rejected (e.g. not authorized, bad request)." ) val acceptedRequests = JicofoMetricsContainer.instance.registerCounter( - "${prefix}_accepted_requests", + "${PREFIX}_accepted_requests", "User requests which were accepted." ) val retries = JicofoMetricsContainer.instance.registerCounter( - "${prefix}_retries", + "${PREFIX}_retries", "Requests retried with a different jigasi instance." ) val singleInstanceErrors = JicofoMetricsContainer.instance.registerCounter( - "${prefix}_instance_errors", + "${PREFIX}_instance_errors", "Errors received from jigasi instances." ) val singleInstanceTimeouts = JicofoMetricsContainer.instance.registerCounter( - "${prefix}_instance_timeouts", + "${PREFIX}_instance_timeouts", "Timeouts for requests sent to jigasi instances." ) diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/muc/ChatRoomRoleManager.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/muc/ChatRoomRoleManager.kt index 9872756232..6506e5b5db 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/muc/ChatRoomRoleManager.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/muc/ChatRoomRoleManager.kt @@ -63,7 +63,9 @@ class AutoOwnerRoleManager(chatRoom: ChatRoom) : ChatRoomRoleManager(chatRoom) { override fun grantOwnership() = queue.add { electNewOwner() } override fun memberJoined(member: ChatRoomMember) { - if (owner == null) { electNewOwner() } + if (owner == null) { + electNewOwner() + } } override fun memberLeftOrKicked(member: ChatRoomMember) { diff --git a/jicofo/src/test/kotlin/org/jitsi/jicofo/DebugStateTest.kt b/jicofo/src/test/kotlin/org/jitsi/jicofo/DebugStateTest.kt index 6d0d1435e5..ed869a9798 100644 --- a/jicofo/src/test/kotlin/org/jitsi/jicofo/DebugStateTest.kt +++ b/jicofo/src/test/kotlin/org/jitsi/jicofo/DebugStateTest.kt @@ -89,7 +89,9 @@ class DebugStateTest : ShouldSpec() { } } -fun OrderedJsonObject.shouldBeValidJson() { JSONParser().parse(this.toJSONString()) } +fun OrderedJsonObject.shouldBeValidJson() { + JSONParser().parse(this.toJSONString()) +} private fun jigasiChatMember(jid: EntityFullJid) = mockk { every { occupantJid } returns jid diff --git a/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/ConferenceTest.kt b/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/ConferenceTest.kt index e44562d4af..591ab12681 100644 --- a/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/ConferenceTest.kt +++ b/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/ConferenceTest.kt @@ -376,7 +376,7 @@ val inPlaceExecutor: ExecutorService = mockk { } } -val inPlaceScheduledExecutor: ScheduledExecutorService = mockk() { +val inPlaceScheduledExecutor: ScheduledExecutorService = mockk { every { schedule(any(), any(), any()) } answers { firstArg().run() mockk(relaxed = true) { @@ -429,14 +429,13 @@ class ColibriAndJingleXmppConnection : MockXmppConnection() { to = sessionInitiate.from sources.toJingle().forEach { addContent(it) } } - fun createSourceRemove( - sources: EndpointSourceSet - ) = JingleIQ(JingleAction.SOURCEREMOVE, sessionInitiate.sid).apply { - from = sessionInitiate.to - type = IQ.Type.set - to = sessionInitiate.from - sources.toJingle().forEach { addContent(it) } - } + fun createSourceRemove(sources: EndpointSourceSet) = + JingleIQ(JingleAction.SOURCEREMOVE, sessionInitiate.sid).apply { + from = sessionInitiate.to + type = IQ.Type.set + to = sessionInitiate.from + sources.toJingle().forEach { addContent(it) } + } fun nextSource(mediaType: MediaType) = this@ColibriAndJingleXmppConnection.nextSource(mediaType) diff --git a/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/ConferenceSourceMapTest.kt b/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/ConferenceSourceMapTest.kt index 4ef270b053..78c4f224bb 100644 --- a/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/ConferenceSourceMapTest.kt +++ b/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/ConferenceSourceMapTest.kt @@ -76,99 +76,99 @@ class ConferenceSourceMapTest : ShouldSpec() { context("Constructors") { context("Default") { - val conferenceSourceMap = ConferenceSourceMap(mutableMapOf(jid1 to endpoint1SourceSet)) + val conferenceSourceMap = ConferenceSourceMap(mutableMapOf(JID_1 to endpoint1SourceSet)) conferenceSourceMap.size shouldBe 1 - conferenceSourceMap[jid1] shouldBe endpoint1SourceSet + conferenceSourceMap[JID_1] shouldBe endpoint1SourceSet } context("With a single EndpointSourceSet") { - val conferenceSourceMap = ConferenceSourceMap(jid1 to endpoint1SourceSet) + val conferenceSourceMap = ConferenceSourceMap(JID_1 to endpoint1SourceSet) conferenceSourceMap.size shouldBe 1 - conferenceSourceMap[jid1] shouldBe endpoint1SourceSet + conferenceSourceMap[JID_1] shouldBe endpoint1SourceSet } context("With multiple EndpointSourceSets") { val conferenceSourceMap = ConferenceSourceMap( - jid1 to endpoint1SourceSet, - jid2 to endpoint2SourceSet + JID_1 to endpoint1SourceSet, + JID_2 to endpoint2SourceSet ) conferenceSourceMap.size shouldBe 2 - conferenceSourceMap[jid1] shouldBe endpoint1SourceSet - conferenceSourceMap[jid2] shouldBe endpoint2SourceSet + conferenceSourceMap[JID_1] shouldBe endpoint1SourceSet + conferenceSourceMap[JID_2] shouldBe endpoint2SourceSet } } context("Add") { - val conferenceSourceMap = ConferenceSourceMap(jid1 to endpoint1SourceSet) + val conferenceSourceMap = ConferenceSourceMap(JID_1 to endpoint1SourceSet) context("Without overlap in endpoints") { - conferenceSourceMap.add(jid2, endpoint2SourceSet) + conferenceSourceMap.add(JID_2, endpoint2SourceSet) conferenceSourceMap.size shouldBe 2 - conferenceSourceMap[jid1] shouldBe endpoint1SourceSet - conferenceSourceMap[jid2] shouldBe endpoint2SourceSet + conferenceSourceMap[JID_1] shouldBe endpoint1SourceSet + conferenceSourceMap[JID_2] shouldBe endpoint2SourceSet } context("With overlap in endpoints") { conferenceSourceMap.add( ConferenceSourceMap( - jid1 to endpoint1AdditionalSourceSet, - jid2 to endpoint2SourceSet + JID_1 to endpoint1AdditionalSourceSet, + JID_2 to endpoint2SourceSet ) ) conferenceSourceMap.size shouldBe 2 - conferenceSourceMap[jid1] shouldBe endpoint1CombinedSourceSet - conferenceSourceMap[jid2] shouldBe endpoint2SourceSet + conferenceSourceMap[JID_1] shouldBe endpoint1CombinedSourceSet + conferenceSourceMap[JID_2] shouldBe endpoint2SourceSet } } context("Remove") { val conferenceSourceMap = ConferenceSourceMap( - jid1 to endpoint1CombinedSourceSet, - jid2 to endpoint2SourceSet + JID_1 to endpoint1CombinedSourceSet, + JID_2 to endpoint2SourceSet ) context("All of an endpoint's sources") { - conferenceSourceMap.remove(ConferenceSourceMap(jid2 to endpoint2SourceSet)) + conferenceSourceMap.remove(ConferenceSourceMap(JID_2 to endpoint2SourceSet)) conferenceSourceMap.size shouldBe 1 - conferenceSourceMap[jid1] shouldBe endpoint1CombinedSourceSet - conferenceSourceMap[jid2] shouldBe null + conferenceSourceMap[JID_1] shouldBe endpoint1CombinedSourceSet + conferenceSourceMap[JID_2] shouldBe null } context("Some of an endpoint's sources") { - conferenceSourceMap.remove(ConferenceSourceMap(jid1 to endpoint1SourceSet)) + conferenceSourceMap.remove(ConferenceSourceMap(JID_1 to endpoint1SourceSet)) conferenceSourceMap.size shouldBe 2 - conferenceSourceMap[jid1] shouldBe EndpointSourceSet( + conferenceSourceMap[JID_1] shouldBe EndpointSourceSet( setOf(s3, s4), setOf(SsrcGroup(SsrcGroupSemantics.Fid, listOf(3, 4))) ) - conferenceSourceMap[jid2] shouldBe endpoint2SourceSet + conferenceSourceMap[JID_2] shouldBe endpoint2SourceSet } context("Nonexistent endpoint sources") { conferenceSourceMap.remove( ConferenceSourceMap( - jid1 to EndpointSourceSet( + JID_1 to EndpointSourceSet( setOf(Source(12345, MediaType.VIDEO)), setOf(SsrcGroup(SsrcGroupSemantics.Fid, listOf(12345))) ) ) ) conferenceSourceMap.size shouldBe 2 - conferenceSourceMap[jid1] shouldBe endpoint1CombinedSourceSet - conferenceSourceMap[jid2] shouldBe endpoint2SourceSet + conferenceSourceMap[JID_1] shouldBe endpoint1CombinedSourceSet + conferenceSourceMap[JID_2] shouldBe endpoint2SourceSet } context("Nonexistent endpoint") { conferenceSourceMap.remove(ConferenceSourceMap("differentJid" to endpoint1CombinedSourceSet)) conferenceSourceMap.size shouldBe 2 - conferenceSourceMap[jid1] shouldBe endpoint1CombinedSourceSet - conferenceSourceMap[jid2] shouldBe endpoint2SourceSet + conferenceSourceMap[JID_1] shouldBe endpoint1CombinedSourceSet + conferenceSourceMap[JID_2] shouldBe endpoint2SourceSet } } context("Operator plus") { - val a = ConferenceSourceMap(jid1 to endpoint1SourceSet) - val b = ConferenceSourceMap(jid2 to endpoint2SourceSet) - (a + b) shouldBe ConferenceSourceMap(jid1 to endpoint1SourceSet, jid2 to endpoint2SourceSet) + val a = ConferenceSourceMap(JID_1 to endpoint1SourceSet) + val b = ConferenceSourceMap(JID_2 to endpoint2SourceSet) + (a + b) shouldBe ConferenceSourceMap(JID_1 to endpoint1SourceSet, JID_2 to endpoint2SourceSet) } context("Operator minus") { - val a = ConferenceSourceMap(jid1 to endpoint1SourceSet, jid2 to endpoint2SourceSet) - val b = ConferenceSourceMap(jid1 to endpoint1SourceSet) - (a - b) shouldBe ConferenceSourceMap(jid2 to endpoint2SourceSet) + val a = ConferenceSourceMap(JID_1 to endpoint1SourceSet, JID_2 to endpoint2SourceSet) + val b = ConferenceSourceMap(JID_1 to endpoint1SourceSet) + (a - b) shouldBe ConferenceSourceMap(JID_2 to endpoint2SourceSet) } context("To Jingle") { - val conferenceSourceMap = ConferenceSourceMap(jid1 to endpoint1SourceSet) + val conferenceSourceMap = ConferenceSourceMap(JID_1 to endpoint1SourceSet) val contents = conferenceSourceMap.toJingle() contents.size shouldBe 2 @@ -182,7 +182,7 @@ class ConferenceSourceMapTest : ShouldSpec() { Source(2, MediaType.VIDEO) ) videoSources.forEach { - it.getFirstChildOfType(SSRCInfoPacketExtension::class.java).owner shouldBe jid1 + it.getFirstChildOfType(SSRCInfoPacketExtension::class.java).owner shouldBe JID_1 } val sourceGroupPacketExtension = @@ -195,21 +195,21 @@ class ConferenceSourceMapTest : ShouldSpec() { val audioSources = audioRtpDesc.getChildExtensionsOfType(SourcePacketExtension::class.java) audioSources.map { Source(MediaType.AUDIO, it) } shouldBe listOf(s7) audioSources.forEach { - it.getFirstChildOfType(SSRCInfoPacketExtension::class.java).owner shouldBe jid1 + it.getFirstChildOfType(SSRCInfoPacketExtension::class.java).owner shouldBe JID_1 } } context("unmodifiable") { val conferenceSourceMap = ConferenceSourceMap( - jid1 to endpoint1SourceSet, - jid2 to endpoint2SourceSet + JID_1 to endpoint1SourceSet, + JID_2 to endpoint2SourceSet ) val unmodifiable = conferenceSourceMap.unmodifiable - unmodifiable[jid1] shouldBe endpoint1SourceSet + unmodifiable[JID_1] shouldBe endpoint1SourceSet - conferenceSourceMap.add(jid1, endpoint1AdditionalSourceSet) - conferenceSourceMap[jid1] shouldBe endpoint1CombinedSourceSet - unmodifiable[jid1] shouldBe endpoint1CombinedSourceSet + conferenceSourceMap.add(JID_1, endpoint1AdditionalSourceSet) + conferenceSourceMap[JID_1] shouldBe endpoint1CombinedSourceSet + unmodifiable[JID_1] shouldBe endpoint1CombinedSourceSet shouldThrow { unmodifiable.add(ConferenceSourceMap()) @@ -224,13 +224,13 @@ class ConferenceSourceMapTest : ShouldSpec() { setOf(s1, s2, s3, s4, s5, s6, s7), setOf(sim, fid1, fid2, fid3) ) - val conferenceSourceMap = ConferenceSourceMap(jid1 to sourceSet, jid2 to e2sourceSet) + val conferenceSourceMap = ConferenceSourceMap(JID_1 to sourceSet, JID_2 to e2sourceSet) // Assume EndpointSourceSet.stripSimulcast works correctly, tested above. context("Simulcast") { conferenceSourceMap.stripSimulcast() - conferenceSourceMap[jid1] shouldBe sourceSet.stripSimulcast - conferenceSourceMap[jid2] shouldBe e2sourceSet.stripSimulcast + conferenceSourceMap[JID_1] shouldBe sourceSet.stripSimulcast + conferenceSourceMap[JID_2] shouldBe e2sourceSet.stripSimulcast } } context("Compact JSON") { diff --git a/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/EndpointSourceSetTest.kt b/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/EndpointSourceSetTest.kt index eab4b50c50..71bed41c57 100644 --- a/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/EndpointSourceSetTest.kt +++ b/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/EndpointSourceSetTest.kt @@ -37,7 +37,7 @@ class EndpointSourceSetTest : ShouldSpec() { init { context("From XML") { // Assume serializing works correctly -- it's tested below. - val contents = sourceSet.toJingle(jid1) + val contents = sourceSet.toJingle(JID_1) val parsed = EndpointSourceSet.fromJingle(contents) // Use the provided ownerJid, not the one encoded in XML. parsed shouldBe sourceSet @@ -128,8 +128,8 @@ class EndpointSourceSetTest : ShouldSpec() { } } -const val jid1 = "jid1" -const val jid2 = "jid2" +const val JID_1 = "jid1" +const val JID_2 = "jid2" val s1 = Source(1, VIDEO) val s2 = Source(2, VIDEO) val s3 = Source(3, VIDEO) diff --git a/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/SourceSignalingTest.kt b/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/SourceSignalingTest.kt index d5905e0b68..d71c57071b 100644 --- a/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/SourceSignalingTest.kt +++ b/jicofo/src/test/kotlin/org/jitsi/jicofo/conference/source/SourceSignalingTest.kt @@ -54,9 +54,9 @@ class SourceSignalingTest : ShouldSpec() { val e4v1a = Source(43, MediaType.VIDEO, name = "e4-v1") val e4v1b = Source(44, MediaType.VIDEO, name = "e4-v1") val e4v1c = Source(45, MediaType.VIDEO, name = "e4-v1") - val e4v1a_r = Source(53, MediaType.VIDEO, name = "e4-v1") - val e4v1b_r = Source(54, MediaType.VIDEO, name = "e4-v1") - val e4v1c_r = Source(55, MediaType.VIDEO, name = "e4-v1") + val e4v1aR = Source(53, MediaType.VIDEO, name = "e4-v1") + val e4v1bR = Source(54, MediaType.VIDEO, name = "e4-v1") + val e4v1cR = Source(55, MediaType.VIDEO, name = "e4-v1") val e4vgroups = setOf( SsrcGroup(SsrcGroupSemantics.Sim, listOf(43, 44, 45)), SsrcGroup(SsrcGroupSemantics.Fid, listOf(43, 53)), @@ -69,7 +69,7 @@ class SourceSignalingTest : ShouldSpec() { val s4audio = ConferenceSourceMap(e4 to EndpointSourceSet(e4a1)) val s4video = ConferenceSourceMap( e4 to EndpointSourceSet( - setOf(e4v1a, e4v1b, e4v1c, e4v1a_r, e4v1b_r, e4v1c_r), + setOf(e4v1a, e4v1b, e4v1c, e4v1aR, e4v1bR, e4v1cR), e4vgroups ) ) diff --git a/jicofo/src/test/kotlin/org/jitsi/jicofo/jibri/JibriSessionTest.kt b/jicofo/src/test/kotlin/org/jitsi/jicofo/jibri/JibriSessionTest.kt index 88f3720200..23430beab2 100644 --- a/jicofo/src/test/kotlin/org/jitsi/jicofo/jibri/JibriSessionTest.kt +++ b/jicofo/src/test/kotlin/org/jitsi/jicofo/jibri/JibriSessionTest.kt @@ -69,8 +69,10 @@ class JibriSessionTest : ShouldSpec({ pendingTimeout, maxNumRetries, detector, - false, // isSIP - null, // sipAddress + // isSIP + false, + // sipAddress + null, "displayName", "streamID", "youTubeBroadcastId", diff --git a/jicofo/src/test/kotlin/org/jitsi/jicofo/mock/MockXmppProvider.kt b/jicofo/src/test/kotlin/org/jitsi/jicofo/mock/MockXmppProvider.kt index 573b1258ee..af85365acd 100644 --- a/jicofo/src/test/kotlin/org/jitsi/jicofo/mock/MockXmppProvider.kt +++ b/jicofo/src/test/kotlin/org/jitsi/jicofo/mock/MockXmppProvider.kt @@ -29,6 +29,5 @@ class MockXmppProvider(val xmppConnection: AbstractXMPPConnection = MockXmppConn every { xmppConnection } returns this@MockXmppProvider.xmppConnection } - fun getRoom(jid: EntityBareJid): MockChatRoom = - chatRooms.computeIfAbsent(jid) { MockChatRoom(this.xmppProvider) } + fun getRoom(jid: EntityBareJid): MockChatRoom = chatRooms.computeIfAbsent(jid) { MockChatRoom(this.xmppProvider) } } diff --git a/jicofo/src/test/kotlin/org/jitsi/jicofo/xmpp/AbstractIqHandlerTest.kt b/jicofo/src/test/kotlin/org/jitsi/jicofo/xmpp/AbstractIqHandlerTest.kt index d9e15237a1..300319781a 100644 --- a/jicofo/src/test/kotlin/org/jitsi/jicofo/xmpp/AbstractIqHandlerTest.kt +++ b/jicofo/src/test/kotlin/org/jitsi/jicofo/xmpp/AbstractIqHandlerTest.kt @@ -105,7 +105,9 @@ private class TestXmppConnection : AbstractXMPPConnection(mockk(relaxed = true)) override fun isUsingCompression(): Boolean = false override fun sendNonza(p0: Nonza?) { } override fun sendStanzaInternal(p0: Stanza?) { } - override fun connectInternal() { connected = true } + override fun connectInternal() { + connected = true + } override fun loginInternal(p0: String?, p1: String?, p2: Resourcepart?) { } override fun instantShutdown() { } override fun shutdown() { } diff --git a/pom.xml b/pom.xml index 46179c888b..fee0da2962 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ 3.0.10 1.0-127-g6c65524 1.1-127-gf49982f - 2.0.0 + 3.0.0 4.6.0 5.10.0 1.13.8