Merge pull request #4106 from ritzalam/restructure-handlers

- restructure handlers to make it easier to test
This commit is contained in:
Richard Alam 2017-07-16 21:37:04 -04:00 committed by GitHub
commit 6f2e3936b1
12 changed files with 39 additions and 28 deletions

View File

@ -1,10 +1,15 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.models.{ UserState, Users2x }
import org.bigbluebutton.core.running.LiveMeeting
trait AssignPresenterReqMsgHdlr {
this: UsersApp2x =>
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleAssignPresenterReqMsg(msg: AssignPresenterReqMsg) {

View File

@ -1,10 +1,15 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.models.{ Roles, Users2x }
import org.bigbluebutton.core.running.LiveMeeting
trait ChangeUserRoleCmdMsgHdlr {
this: UsersApp2x =>
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleChangeUserRoleCmdMsg(msg: ChangeUserRoleCmdMsg) {
for {

View File

@ -7,7 +7,7 @@ import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.message.senders.MsgBuilder
trait EjectUserFromMeetingCmdMsgHdlr {
this: BaseMeetingActor =>
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway

View File

@ -6,7 +6,7 @@ import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait GetRecordingStatusReqMsgHdlr {
this: BaseMeetingActor =>
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway

View File

@ -8,7 +8,7 @@ import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait LogoutAndEndMeetingCmdMsgHdlr {
this: BaseMeetingActor =>
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway

View File

@ -6,7 +6,7 @@ import org.bigbluebutton.core.domain.MeetingInactivityTracker
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting, MeetingInactivityTrackerHelper }
trait MeetingActivityResponseCmdMsgHdlr {
this: BaseMeetingActor =>
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway

View File

@ -7,7 +7,7 @@ import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait RegisterUserReqMsgHdlr {
this: BaseMeetingActor =>
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway

View File

@ -6,7 +6,7 @@ import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait SetRecordingStatusCmdMsgHdlr {
this: BaseMeetingActor =>
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway

View File

@ -6,7 +6,7 @@ import org.bigbluebutton.core.models.Users2x
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
trait SyncGetUsersMeetingRespMsgHdlr {
this: BaseMeetingActor =>
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway

View File

@ -12,7 +12,16 @@ class UsersApp(
)(implicit val context: ActorContext)
extends ValidateAuthTokenReqMsgHdlr
with GetUsersMeetingReqMsgHdlr {
with GetUsersMeetingReqMsgHdlr
with RegisterUserReqMsgHdlr
with ChangeUserRoleCmdMsgHdlr
with SyncGetUsersMeetingRespMsgHdlr
with LogoutAndEndMeetingCmdMsgHdlr
with MeetingActivityResponseCmdMsgHdlr
with SetRecordingStatusCmdMsgHdlr
with GetRecordingStatusReqMsgHdlr
with AssignPresenterReqMsgHdlr
with EjectUserFromMeetingCmdMsgHdlr {
val log = Logging(context.system, getClass)
}

View File

@ -4,16 +4,8 @@ import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.message.handlers.users.{ ChangeUserEmojiCmdMsgHdlr, ValidateAuthTokenReqMsgHdlr }
trait UsersApp2x
extends RegisterUserReqMsgHdlr
with ChangeUserRoleCmdMsgHdlr
with SyncGetUsersMeetingRespMsgHdlr
with UserLeaveReqMsgHdlr
with LogoutAndEndMeetingCmdMsgHdlr
with MeetingActivityResponseCmdMsgHdlr
with SetRecordingStatusCmdMsgHdlr
with GetRecordingStatusReqMsgHdlr
with AssignPresenterReqMsgHdlr
with EjectUserFromMeetingCmdMsgHdlr
extends UserLeaveReqMsgHdlr
with ChangeUserEmojiCmdMsgHdlr {
this: MeetingActor =>

View File

@ -127,7 +127,7 @@ class MeetingActor(
// Handling RegisterUserReqMsg as it is forwarded from BBBActor and
// its type is not BbbCommonEnvCoreMsg
case m: RegisterUserReqMsg => handleRegisterUserReqMsg(m)
case m: RegisterUserReqMsg => usersApp.handleRegisterUserReqMsg(m)
case m: GetAllMeetingsReqMsg => handleGetAllMeetingsReqMsg(m)
// Meeting
@ -165,12 +165,12 @@ class MeetingActor(
case m: UserBroadcastCamStartMsg => handleUserBroadcastCamStartMsg(m)
case m: UserBroadcastCamStopMsg => handleUserBroadcastCamStopMsg(m)
case m: UserJoinedVoiceConfEvtMsg => handleUserJoinedVoiceConfEvtMsg(m)
case m: MeetingActivityResponseCmdMsg => inactivityTracker = handleMeetingActivityResponseCmdMsg(m, inactivityTracker)
case m: LogoutAndEndMeetingCmdMsg => handleLogoutAndEndMeetingCmdMsg(m)
case m: SetRecordingStatusCmdMsg => handleSetRecordingStatusCmdMsg(m)
case m: GetRecordingStatusReqMsg => handleGetRecordingStatusReqMsg(m)
case m: MeetingActivityResponseCmdMsg => inactivityTracker = usersApp.handleMeetingActivityResponseCmdMsg(m, inactivityTracker)
case m: LogoutAndEndMeetingCmdMsg => usersApp.handleLogoutAndEndMeetingCmdMsg(m)
case m: SetRecordingStatusCmdMsg => usersApp.handleSetRecordingStatusCmdMsg(m)
case m: GetRecordingStatusReqMsg => usersApp.handleGetRecordingStatusReqMsg(m)
case m: ChangeUserEmojiCmdMsg => handleChangeUserEmojiCmdMsg(m)
case m: EjectUserFromMeetingCmdMsg => handleEjectUserFromMeetingCmdMsg(m)
case m: EjectUserFromMeetingCmdMsg => usersApp.handleEjectUserFromMeetingCmdMsg(m)
case m: GetUsersMeetingReqMsg => usersApp.handleGetUsersMeetingReqMsg(m)
// Whiteboard
@ -271,7 +271,7 @@ class MeetingActor(
handleSyncGetMeetingInfoRespMsg(liveMeeting.props)
// sync all users
handleSyncGetUsersMeetingRespMsg()
usersApp.handleSyncGetUsersMeetingRespMsg()
// sync all presentations
presentationApp2x.handleSyncGetPresentationInfoRespMsg()
@ -286,7 +286,7 @@ class MeetingActor(
handleStopPollReqMsg(msg.header.userId)
// switch user presenter status for old and new presenter
handleAssignPresenterReqMsg(msg)
usersApp.handleAssignPresenterReqMsg(msg)
// TODO stop current screen sharing session (initiated by the old presenter)