@Override public void onBlipAdded(ObservableConversationBlip blip) { if (capabilities.containsKey(EventType.WAVELET_BLIP_CREATED)) { String rootBlipId = ConversationUtil.getRootBlipId(conversation); WaveletBlipCreatedEvent event = new WaveletBlipCreatedEvent( null, null, deltaAuthor.getAddress(), deltaTimestamp, rootBlipId, blip.getId()); addEvent(event, capabilities, rootBlipId, messages); } }
/** * Processes a {@link WaveletBlipCreatedEvent} and puts it into the context. * * @param operation the operation that has been performed * @param context the context of the operation. * @param participant the participant performing the operation. * @param conversation the conversation to which the new blip was added * @param newBlip the newly created blip. * @throws InvalidRequestException if the event could not be processed. */ private void processBlipCreatedEvent(OperationRequest operation, OperationContext context, ParticipantId participant, ObservableConversation conversation, ConversationBlip newBlip) throws InvalidRequestException { WaveletBlipCreatedEvent event = new WaveletBlipCreatedEvent(null, null, participant.getAddress(), System.currentTimeMillis(), ConversationUtil.getRootBlipId(conversation), newBlip.getId()); context.processEvent(operation, event); }
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()); }