/** * Tests that closing the channel before the server has responded with a * channel id does not issue a ViewClose rpc. */ public void testCloseWithoutChannelIdDoesNotCallCloseRpc() { halfOpen(); close(); assertEquals(0, waveViewService.closes.size()); }
/** * Tests that closing the channel before the server has responded with a * channel id does not issue a ViewClose rpc. */ public void testCloseWithoutChannelIdDoesNotCallCloseRpc() { halfOpen(); close(); assertEquals(0, waveViewService.closes.size()); }
/** * Opens the channel, and simulates the server responding with a channel and * a marker. */ private void open() { halfOpen(); respondWithChannelId(); respondWithMarker(false); }
/** * Tests a channel fails if it receives success before channel id. */ public void testSuccessBeforeChannelIdFails() { halfOpen(); channel.onSuccess("for testing"); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_EXCEPTION); }
public void testFailedOpenCallsListenerFailure() { halfOpen(); // fail the open terminateOpenRpcWithFailure("WAVE_SERVER_ERROR"); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_CLOSED); }
/** * Tests that an update with the end-marker triggers the open-finished * callback. */ public void testChannelIdTriggersConnectCallback() { halfOpen(); respondWithChannelId(); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_CONNECTED); }
/** * Tests a channel fails if it receives success before channel id. */ public void testSuccessBeforeChannelIdFails() { halfOpen(); channel.onSuccess("for testing"); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_EXCEPTION); }
/** * Tests a channel closes if it receives failure before channel id. */ public void testFailureBeforeChannelIdClosesChannel() { halfOpen(); channel.onFailure("for testing"); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_CLOSED); }
/** * Tests that an update with the end-marker triggers the open-finished * callback. */ public void testChannelIdTriggersConnectCallback() { halfOpen(); respondWithChannelId(); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_CONNECTED); }
/** * Opens the channel, and simulates the server responding with a channel and * a marker. */ private void open() { halfOpen(); respondWithChannelId(); respondWithMarker(false); }
/** * Tests a channel closes if it receives failure before channel id. */ public void testFailureBeforeChannelIdClosesChannel() { halfOpen(); channel.onFailure("for testing"); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_CLOSED); }
public void testFailedOpenCallsListenerFailure() { halfOpen(); // fail the open terminateOpenRpcWithFailure("WAVE_SERVER_ERROR"); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_CLOSED); }
public void testOpenAfterCloseThrowsIllegalStateException() { open(); close(); // Opening the channel again should fail. try { halfOpen(); fail("Should not be able to open a closed channel"); } catch (IllegalStateException ex) { // expect exception } }
public void testOpenAfterCloseThrowsIllegalStateException() { open(); close(); // Opening the channel again should fail. try { halfOpen(); fail("Should not be able to open a closed channel"); } catch (IllegalStateException ex) { // expect exception } }
/** * Tests that an update with the end-marker triggers the open-finished * callback. */ public void testMarkerTriggersOpenFinished() { halfOpen(); respondWithChannelId(); viewOpenListener.clear(); respondWithMarker(false); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_OPEN_FINISHED); }
/** * Tests that closing the channel before the server has responded with a * channel id causes a ViewClose rpc to be sent as soon as a channel id * arrives later. */ public void testCloseWithoutChannelIdCallsCloseRpcIfChannelIdArrives() { halfOpen(); close(); assertEquals(0, waveViewService.closes.size()); respondWithChannelId(); // Have got channel id, so we should now have issued a close. assertEquals(1, waveViewService.closes.size()); waveViewService.lastClose().callback.onSuccess(); }
/** * Tests that an update with the end-marker triggers the open-finished * callback. */ public void testMarkerTriggersOpenFinished() { halfOpen(); respondWithChannelId(); viewOpenListener.clear(); respondWithMarker(false); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_OPEN_FINISHED); }
/** * Tests that a channel fails if it does not receive a channel id in the first * message. */ public void testInitialUpdateWithoutAChannelIdFails() { halfOpen(); // Receive an update with no channel id. waveViewService.lastOpen().callback.onUpdate(new FakeWaveViewServiceUpdate()); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_EXCEPTION); }
/** * Tests that a channel fails if it does not receive a channel id in the first * message. */ public void testInitialUpdateWithoutAChannelIdFails() { halfOpen(); // Receive an update with no channel id. waveViewService.lastOpen().callback.onUpdate(new FakeWaveViewServiceUpdate()); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_EXCEPTION); }
/** * Tests that updates that arrive before the end-marker are passed on as * updates, and that when the end-marker eventually arrives, open-finished * is triggered then. */ public void testUpdatesBeforeOpenFinishedStillTriggersOpenFinished() { halfOpen(); respondWithChannelId(); viewOpenListener.clear(); respondWithEmptyUpdate(WAVELET_ID); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_UPDATE, WAVELET_ID); respondWithMarker(false); viewOpenListener.expectedCall(MockViewChannelListener.MethodCall.ON_OPEN_FINISHED); }