@Test public void testRestartExceedsMaximumAttempts() throws InterruptedException { final Map<String, String> parameters = new HashMap<>(5); parameters.put("ri", "RE0001"); parameters.put("rsk", "*"); parameters.put("rlt", "100"); parameters.put("ip", "prompt1.wav,prompt2.wav,prompt3.wav"); parameters.put("rp", "reprompt1.wav,reprompt2.wav,reprompt3.wav"); parameters.put("ns", "nospeech1.wav,nospeech2.wav,nospeech3.wav"); parameters.put("na", "1"); final MgcpEventObserver observer = mock(MgcpEventObserver.class); final Recorder recorder = mock(Recorder.class); final DtmfSinkFacade detector = mock(DtmfSinkFacade.class); final Player player = mock(Player.class); final PlayRecord pr = new PlayRecord(player, detector, recorder, 1, parameters); final ArgumentCaptor<MgcpEvent> eventCaptor = ArgumentCaptor.forClass(MgcpEvent.class); pr.observe(observer); pr.execute(); pr.playerListener.process(new AudioPlayerEvent(player, PlayerEvent.STOP)); pr.playerListener.process(new AudioPlayerEvent(player, PlayerEvent.STOP)); pr.playerListener.process(new AudioPlayerEvent(player, PlayerEvent.STOP)); pr.detectorObserver.onDtmfEvent(new DtmfEvent("*")); verify(detector, times(1)).activate(); verify(recorder, times(1)).activate(); verify(player, times(3)).activate(); verify(player, times(1)).deactivate(); verify(detector, times(1)).deactivate(); verify(recorder, times(1)).deactivate(); verify(observer, timeout(100)).onEvent(eq(pr), eventCaptor.capture()); assertEquals(String.valueOf(ReturnCode.MAX_ATTEMPTS_EXCEEDED.code()), eventCaptor.getValue().getParameter("rc")); assertEquals("1", eventCaptor.getValue().getParameter("na")); }
@Override public void execute() { if (!this.fsm.isStarted()) { this.fsm.start(this.context); } }
PlayRecord extends AbstractMgcpSignal { @Override public void execute() { if (!this.fsm.isStarted()) { this.fsm.start(this.context); } } }
PlayRecord extends AbstractMgcpSignal { @Override public void execute() { if (!this.fsm.isStarted()) { this.fsm.start(this.context); } } PlayRecord(Player player, DtmfEventSubject detector, Recorder recorder, int requestId, NotifiedEntity notifiedEntity, Map<String, String> parameters);  PlayRecord(Player player, DtmfEventSubject detector, Recorder recorder, int requestId, Map<String, String> parameters); }
PlayRecord extends AbstractMgcpSignal { @Override public void execute() { if (!this.fsm.isStarted()) { this.fsm.start(this.context); } } PlayRecord(Player player, DtmfEventSubject detector, Recorder recorder, int requestId, NotifiedEntity notifiedEntity, Map<String, String> parameters);  PlayRecord(Player player, DtmfEventSubject detector, Recorder recorder, int requestId, Map<String, String> parameters); @Override void execute(); @Override void cancel(); }
PlayRecord extends AbstractMgcpSignal { @Override public void execute() { if (!this.fsm.isStarted()) { this.fsm.start(this.context); } } PlayRecord(Player player, DtmfEventSubject detector, Recorder recorder, int requestId, NotifiedEntity notifiedEntity, Map<String, String> parameters);  PlayRecord(Player player, DtmfEventSubject detector, Recorder recorder, int requestId, Map<String, String> parameters); @Override void execute(); @Override void cancel();  }