|
42 | 42 | import org.restcomm.connect.telephony.api.ConferenceResponse; |
43 | 43 | import org.restcomm.connect.telephony.api.ConferenceStateChanged; |
44 | 44 | import org.restcomm.connect.telephony.api.CreateConference; |
| 45 | +import org.restcomm.connect.telephony.api.StopConference; |
45 | 46 | import org.restcomm.connect.telephony.util.ConferenceTestUtil; |
46 | 47 |
|
47 | 48 | import akka.actor.ActorRef; |
@@ -303,4 +304,41 @@ public UntypedActor create() throws Exception { |
303 | 304 | return system.actorOf(props); |
304 | 305 | } |
305 | 306 |
|
| 307 | + @Test |
| 308 | + public void testStopConferenceWithNoLocalParticipants() throws URISyntaxException { |
| 309 | + new JavaTestKit(system) { |
| 310 | + { |
| 311 | + daoManager = mock(DaoManager.class); |
| 312 | + CallDetailRecordsDao callDetailRecordsDao = mock(CallDetailRecordsDao.class); |
| 313 | + ConferenceDetailRecordsDao conferenceDetailRecordsDao = mock(ConferenceDetailRecordsDao.class); |
| 314 | + when(callDetailRecordsDao.getTotalRunningCallDetailRecordsByConferenceSid(any(Sid.class))).thenReturn(0); |
| 315 | + when(daoManager.getCallDetailRecordsDao()).thenReturn(callDetailRecordsDao); |
| 316 | + when(daoManager.getConferenceDetailRecordsDao()).thenReturn(conferenceDetailRecordsDao); |
| 317 | + |
| 318 | + |
| 319 | + final ActorRef tester = getRef(); |
| 320 | + // Create MockFailingMmsControllerFactory |
| 321 | + MediaServerControllerFactory factory = new MockMmsControllerFactory(system, null); |
| 322 | + // Create ConferenceCenter |
| 323 | + final ActorRef conferenceCenter = conferenceCenter(factory, daoManager); |
| 324 | + |
| 325 | + // get a fresh conference from conferenecneter |
| 326 | + final CreateConference create = new CreateConference(CONFERENCE_FRIENDLY_NAME_1, new Sid(CALL_SID)); |
| 327 | + conferenceCenter.tell(create, tester); |
| 328 | + ConferenceCenterResponse conferenceCenterResponse = expectMsgClass(ConferenceCenterResponse.class); |
| 329 | + ActorRef conferene = conferenceCenterResponse.get(); |
| 330 | + |
| 331 | + // start observing conference |
| 332 | + conferene.tell(new Observe(tester), tester); |
| 333 | + Observing observingResponse = expectMsgClass(Observing.class); |
| 334 | + assertTrue(observingResponse.succeeded()); |
| 335 | + |
| 336 | + // stop conference while no local participants is there |
| 337 | + conferene.tell(new StopConference(), tester); |
| 338 | + ConferenceStateChanged conferenceStateChanged = expectMsgClass(ConferenceStateChanged.class); |
| 339 | + assertEquals(ConferenceStateChanged.State.COMPLETED, conferenceStateChanged.state()); |
| 340 | + |
| 341 | + }}; |
| 342 | + } |
| 343 | + |
306 | 344 | } |
0 commit comments