Package com.google.wave.api

Examples of com.google.wave.api.JsonRpcResponse


        Parameter.of(ParamsProperty.BLIP_DATA, blipData));

    OperationContextImpl context = helper.getContext();
    service.execute(operation, context, ALEX);

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

    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot();
    ConversationBlip newBlip = checkAndGetNewBlip(context, conversation, response);
View Full Code Here


    OperationRequest operation = operationRequest(OperationType.DOCUMENT_APPEND_MARKUP,
        markupBlip.getId(), Parameter.of(ParamsProperty.CONTENT, markup));

    service.execute(operation, context, ALEX);

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

    // The xml in new blip should match custom markup.
    String actualContent = markupBlip.getContent().toXmlString();
    assertTrue("Expected the new blip to contain the custom markup as specified in the " +
        "operation. actualcontent: " + actualContent, actualContent.contains(markup));
View Full Code Here

    OperationRequest operation = operationRequest(OperationType.DOCUMENT_APPEND_MARKUP,
        markupBlip.getId(), Parameter.of(ParamsProperty.CONTENT, markup));

    service.execute(operation, context, ALEX);

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

    // The output should now include the default <line/> element.
    String lineContent = markupBlip.getContent().toXmlString();
    assertTrue("Expected the blip to append the default wave <line/> element. " +
        "actual content: " + lineContent, lineContent.contains("<line/>"+markup));
View Full Code Here

    OperationRequest operation = operationRequest(OperationType.DOCUMENT_APPEND_INLINE_BLIP,
        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 LocatedReplyThread<? extends ObservableConversationThread>> it =
        conversation.getRootThread().getFirstBlip().locateReplyThreads().iterator();
View Full Code Here

        rootBlipId, Parameter.of(ParamsProperty.BLIP_DATA, blipData),
        Parameter.of(ParamsProperty.INDEX, insertAtApiLocation));

    service.execute(operation, context, ALEX);

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

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

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

        Parameter.of(ParamsProperty.BLIP_DATA, blipData),
        Parameter.of(ParamsProperty.ELEMENT, inlineBlipElement));

    service.execute(operation, context, ALEX);

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

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

    // The second InlineReplyThread is created by the BlipOperationService, it
    // should be located just after the first one.
View Full Code Here

    String rootBlipId = ConversationUtil.getRootBlipId(conversation);
    OperationRequest operation = operationRequest(OperationType.BLIP_DELETE, rootBlipId);

    service.execute(operation, context, ALEX);

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertFalse(response.isError());
    assertNull("Blip should have been deleted", conversation.getBlip(rootBlipId));
  }
View Full Code Here

  public void testDeserializeJsonRpcErrorResponse() throws Exception {
    String response = "{'id':'op1','error':{'message':'Not authorized!'}}";
    JsonElement jsonElement = new JsonParser().parse(response);

    JsonRpcResponseGsonAdaptor adaptor = new JsonRpcResponseGsonAdaptor();
    JsonRpcResponse result = adaptor.deserialize(jsonElement, null, null);
    assertTrue(result.isError());
    assertEquals("op1", result.getId());
    assertEquals("Not authorized!", result.getErrorMessage());
  }
View Full Code Here

            return ((JsonPrimitive) (invocation.getArguments()[0])).getAsString();
          }
        });

    JsonRpcResponseGsonAdaptor adaptor = new JsonRpcResponseGsonAdaptor();
    JsonRpcResponse result = adaptor.deserialize(jsonElement, null, mockContext);
    assertFalse(result.isError());
    assertEquals("op1", result.getId());
    assertEquals(1, result.getData().size());
    assertEquals("blip1", result.getData().get(ParamsProperty.NEW_BLIP_ID));
  }
View Full Code Here

    // Ensure that responses are returned in the same order as corresponding
    // requests.
    LinkedList<JsonRpcResponse> responses = Lists.newLinkedList();
    for (OperationRequest operation : operations) {
      String opId = operation.getId();
      JsonRpcResponse response = results.getResponses().get(opId);
      responses.addLast(response);
    }

    String jsonResponse =
        robotSerializer.serialize(responses, GsonFactory.JSON_RPC_RESPONSE_LIST_TYPE, version);
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.