public void testOpenExistingWaveletForNonParticipantThrowsInvalidRequestException() throws Exception { ParticipantId nonExistingParticipant = ParticipantId.ofUnsafe("nonexisting@example.com"); assertFalse("This participant should not exist", waveletData.getParticipants().contains(nonExistingParticipant)); try { operationContext.openWavelet(WAVE_ID, WAVELET_ID, nonExistingParticipant); fail("Expected InvalidRequestException for a non-existing participant"); } catch (InvalidRequestException e) { // expected } }
public void testOpenExistingWaveletForNonParticipantThrowsInvalidRequestException() throws Exception { ParticipantId nonExistingParticipant = ParticipantId.ofUnsafe("nonexisting@example.com"); assertFalse("This participant should not exist", waveletData.getParticipants().contains(nonExistingParticipant)); try { operationContext.openWavelet(WAVE_ID, WAVELET_ID, nonExistingParticipant); fail("Expected InvalidRequestException for a non-existing participant"); } catch (InvalidRequestException e) { // expected } }
public void testContextIsBound() throws Exception { assertTrue("Bound contexts should return true", boundOperationContext.isBound()); Map<WaveletName, RobotWaveletData> openWavelets = boundOperationContext.getOpenWavelets(); assertEquals("Bound wavelet should be open", openWavelets.get(WAVELET_NAME), wavelet); assertFalse("Unbound contexts should return false", operationContext.isBound()); }
public void testContextIsBound() throws Exception { assertTrue("Bound contexts should return true", boundOperationContext.isBound()); Map<WaveletName, RobotWaveletData> openWavelets = boundOperationContext.getOpenWavelets(); assertEquals("Bound wavelet should be open", openWavelets.get(WAVELET_NAME), wavelet); assertFalse("Unbound contexts should return false", operationContext.isBound()); }
public void testConstructResponse() { Map<ParamsProperty, Object> data = Maps.newHashMap(); data.put(ParamsProperty.PARTICIPANT_ID, USERNAME); operationContext.constructResponse(request, data); JsonRpcResponse response = operationContext.getResponse(request.getId()); assertFalse("Expected non-error response", response.isError()); assertEquals("Expected operation id not to change", OPERATION_ID, response.getId()); assertEquals("Expected payload not to change", data, response.getData()); }
public void testConstructResponse() { Map<ParamsProperty, Object> data = Maps.newHashMap(); data.put(ParamsProperty.PARTICIPANT_ID, USERNAME); operationContext.constructResponse(request, data); JsonRpcResponse response = operationContext.getResponse(request.getId()); assertFalse("Expected non-error response", response.isError()); assertEquals("Expected operation id not to change", OPERATION_ID, response.getId()); assertEquals("Expected payload not to change", data, response.getData()); }
public void testProcessEvent() throws Exception { // A randomly selected non-error event Event event = new WaveletBlipCreatedEvent(null, null, USERNAME, 0L, "root", "newBlip"); operationContext.processEvent(request, event); JsonRpcResponse response = operationContext.getResponse(request.getId()); assertFalse("Expected non-error response", response.isError()); assertEquals("Expected operation id not to change", OPERATION_ID, response.getId()); }
public void testProcessEvent() throws Exception { // A randomly selected non-error event Event event = new WaveletBlipCreatedEvent(null, null, USERNAME, 0L, "root", "newBlip"); operationContext.processEvent(request, event); JsonRpcResponse response = operationContext.getResponse(request.getId()); assertFalse("Expected non-error response", response.isError()); assertEquals("Expected operation id not to change", OPERATION_ID, response.getId()); }