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 package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._ import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.models.{ UserState, Users2x } import org.bigbluebutton.core.models.{ UserState, Users2x }
import org.bigbluebutton.core.running.LiveMeeting
trait AssignPresenterReqMsgHdlr { trait AssignPresenterReqMsgHdlr {
this: UsersApp2x => this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleAssignPresenterReqMsg(msg: AssignPresenterReqMsg) { def handleAssignPresenterReqMsg(msg: AssignPresenterReqMsg) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,16 @@ class UsersApp(
)(implicit val context: ActorContext) )(implicit val context: ActorContext)
extends ValidateAuthTokenReqMsgHdlr 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) 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 } import org.bigbluebutton.core2.message.handlers.users.{ ChangeUserEmojiCmdMsgHdlr, ValidateAuthTokenReqMsgHdlr }
trait UsersApp2x trait UsersApp2x
extends RegisterUserReqMsgHdlr extends UserLeaveReqMsgHdlr
with ChangeUserRoleCmdMsgHdlr
with SyncGetUsersMeetingRespMsgHdlr
with UserLeaveReqMsgHdlr
with LogoutAndEndMeetingCmdMsgHdlr
with MeetingActivityResponseCmdMsgHdlr
with SetRecordingStatusCmdMsgHdlr
with GetRecordingStatusReqMsgHdlr
with AssignPresenterReqMsgHdlr
with EjectUserFromMeetingCmdMsgHdlr
with ChangeUserEmojiCmdMsgHdlr { with ChangeUserEmojiCmdMsgHdlr {
this: MeetingActor => this: MeetingActor =>

View File

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