Package com.google.wave.api

Examples of com.google.wave.api.JsonRpcResponse


    OperationContextImpl context =
        new OperationContextImpl(waveletProvider, converter, conversationUtil);

    operationService.execute(request, context, BOB);

    JsonRpcResponse response = context.getResponse(request.getId());
    assertFalse("Expected non error response", response.isError());
    assertTrue("Empty Response must be set", response.getData().isEmpty());
  }
View Full Code Here


    service.execute(operation, context, ALEX);

    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot();

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertNotNull("expected a response", response);
    assertFalse("expected a success response", response.isError());
    assertEquals("Expected the response to carry the message", message,
        response.getData().get(ParamsProperty.MESSAGE));
    assertNotNull("Expected the response to carry a wavelet",
        response.getData().get(ParamsProperty.WAVELET_DATA));
    assertEquals("Expected the response to carry root blip id",
        conversation.getRootThread().getFirstBlip().getId(),
        response.getData().get(ParamsProperty.BLIP_ID));
  }
View Full Code Here

  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());
  }
View Full Code Here

    assertEquals("Expected payload not to change", data, response.getData());
  }

  public void testConstructErrorResponse() {
    operationContext.constructErrorResponse(request, ERROR_MESSAGE);
    JsonRpcResponse response = operationContext.getResponse(request.getId());
    assertTrue("Expected error response", response.isError());
    assertEquals("Expected provided error message", ERROR_MESSAGE, response.getErrorMessage());
    assertEquals("Expected operation id not to change", OPERATION_ID, response.getId());
  }
View Full Code Here

    // 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());
  }
View Full Code Here

  public void testProcessErrorEvent() throws Exception {
    // A randomly selected non-error event
    Event event = new OperationErrorEvent(null, null, USERNAME, 0L, OPERATION_ID, ERROR_MESSAGE);
    operationContext.processEvent(request, event);

    JsonRpcResponse response = operationContext.getResponse(request.getId());
    assertTrue("Expected error response", response.isError());
    assertEquals("Expected provided error message", ERROR_MESSAGE, response.getErrorMessage());
    assertEquals("Expected operation id not to change", OPERATION_ID, response.getId());
  }
View Full Code Here

  public void testCreateWaveletService() throws Exception {
    when(waveletData.getParticipants()).thenReturn(Collections.singletonList(BOB.getAddress()));

    service.execute(operation, context, ALEX);

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertFalse(response.isError());
    Map<ParamsProperty, Object> responseData = response.getData();
    assertEquals("Expected message to be set", MESSAGE, responseData.get(ParamsProperty.MESSAGE));

    WaveId waveId = ApiIdSerializer.instance().deserialiseWaveId(
        (String)responseData.get(ParamsProperty.WAVE_ID));
    WaveletId waveletId = ApiIdSerializer.instance().deserialiseWaveletId(
View Full Code Here

        operationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, rootBlipId,
            Parameter.of(ParamsProperty.PARTICIPANT_ID,ALEX.getAddress()));

    service.execute(operation, context, ROBOT);

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertFalse("Add Participant generated error in service execution.", response.isError());

    // Verify Alex is now a participant on the wave.
    participants = conversation.getParticipantIds();
    assertTrue("Alex should now be a participant on the wavelet.", participants.contains(ALEX));
  }
View Full Code Here

    OperationRequest operation = operationRequest(OperationType.BLIP_CONTINUE_THREAD,
        rootBlipId, Parameter.of(ParamsProperty.BLIP_DATA, blipData));

    service.execute(operation, context, ALEX);

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertFalse(response.isError());

    ConversationBlip newBlip = checkAndGetNewBlip(context, conversation, response);

    Iterator<? extends ObservableConversationBlip> it =
        conversation.getRootThread().getBlips().iterator();
View Full Code Here

    OperationRequest operation = operationRequest(OperationType.BLIP_CREATE_CHILD, rootBlipId,
        Parameter.of(ParamsProperty.BLIP_DATA, blipData));

    service.execute(operation, context, ALEX);

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertFalse(response.isError());

    ConversationBlip newBlip = checkAndGetNewBlip(context, conversation, response);

    Iterator<? extends ObservableConversationThread> it =
        conversation.getRootThread().getFirstBlip().getReplyThreads().iterator();
View Full Code Here

TOP

Related Classes of com.google.wave.api.JsonRpcResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.