Package com.google.wave.api

Examples of com.google.wave.api.OperationRequest


    operationService = DoNothingService.create();
  }

  public void testReturnsEmptyResponse() throws Exception {
    // Type of operation doesn't matter in this case
    OperationRequest request = new OperationRequest("wavelet.fetch", "op1");

    WaveletProvider waveletProvider = mock(WaveletProvider.class);
    EventDataConverter converter = mock(EventDataConverter.class);
    ConversationUtil conversationUtil = mock(ConversationUtil.class);

    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


    helper = new OperationServiceHelper(WAVELET_NAME, ALEX);
  }

  public void testFetchWave() throws Exception {
    String message = "A message";
    OperationRequest operation =
        operationRequest(OperationType.ROBOT_FETCH_WAVE,
            Parameter.of(ParamsProperty.MESSAGE, message));
    OperationContextImpl context = helper.getContext();
    WaveletProvider waveletProvider = helper.getWaveletProvider();
    when(waveletProvider.checkAccessPermission(WAVELET_NAME, ALEX)).thenReturn(true);
View Full Code Here

        response.getData().get(ParamsProperty.BLIP_ID));
  }

  public void testFetchWaveWithMissingParamThrowsInvalidRequestException() throws Exception {
    // No wave id or wavelet id set.
    OperationRequest operation = new OperationRequest(OperationType.ROBOT_FETCH_WAVE.method(),
        OPERATION_ID);
    OperationContextImpl context = helper.getContext();

    try {
      service.execute(operation, context, ALEX);
View Full Code Here

    when(accountStore.getAccount(ROBOT)).thenReturn(ROBOT_ACCOUNT);
    when(connector.fetchCapabilities(eq(ROBOT_ACCOUNT), anyString())).thenReturn(NEW_ROBOT_ACCOUNT);
  }

  public void testUpdateCapabilites() throws Exception {
    OperationRequest operation = new OperationRequest(
        "robot.notify", OP_ID, Parameter.of(ParamsProperty.CAPABILITIES_HASH, NEW_HASH));

    operationService.execute(operation, context, ROBOT);

    verify(connector).fetchCapabilities(eq(ROBOT_ACCOUNT), anyString());
View Full Code Here

    verify(connector).fetchCapabilities(eq(ROBOT_ACCOUNT), anyString());
    verify(accountStore).putAccount(NEW_ROBOT_ACCOUNT);
  }

  public void testDontUpdateIfHashesMatch() throws Exception {
    OperationRequest operation =
        new OperationRequest("robot.notify", OP_ID, Parameter.of(ParamsProperty.CAPABILITIES_HASH,
            OLD_HASH));

    operationService.execute(operation, context, ROBOT);

    verifyZeroInteractions(connector);
View Full Code Here

    verifyZeroInteractions(connector);
    verify(accountStore, never()).putAccount(any(AccountData.class));
  }

  public void testErrorOnFailingConnection() throws Exception {
    OperationRequest operation =
        new OperationRequest("robot.notify", OP_ID, Parameter.of(ParamsProperty.CAPABILITIES_HASH,
            NEW_HASH));

    when(connector.fetchCapabilities(any(RobotAccountData.class), anyString())).thenThrow(
        new CapabilityFetchException(""));
View Full Code Here

    verify(accountStore, never()).putAccount(any(AccountData.class));
    verify(context).constructErrorResponse(eq(operation), anyString());
  }

  public void testExceptionOnUnknownAccount() throws Exception {
    OperationRequest operation =
        new OperationRequest("robot.notify", OP_ID, Parameter.of(ParamsProperty.CAPABILITIES_HASH,
            NEW_HASH));

    when(accountStore.getAccount(ROBOT)).thenReturn(null);

    try {
View Full Code Here

    verifyZeroInteractions(connector);
    verify(accountStore, never()).putAccount(any(AccountData.class));
  }

  public void testExceptionOnMissingHash() throws Exception {
    OperationRequest operation = new OperationRequest("robot.notify", OP_ID);

    try {
      operationService.execute(operation, context, ROBOT);
      fail("Expected InvalidRequestException");
    } catch (InvalidRequestException e) {
View Full Code Here

  protected void setUp() throws Exception {
    converter = mock(EventDataConverter.class);
    waveletProvider = mock(WaveletProvider.class);
    conversationUtil = mock(ConversationUtil.class);

    request = new OperationRequest("wave.setTitle", OPERATION_ID);
    operationContext = new OperationContextImpl(waveletProvider, converter, conversationUtil);

    waveletData = WaveletDataUtil.createEmptyWavelet(WAVELET_NAME, PARTICIPANT,
        HASH_FACTORY.createVersionZero(WAVELET_NAME), 0L);
    waveletData.addParticipant(PARTICIPANT);
View Full Code Here

        context.openWavelet(WAVE_ID, WAVELET_ID, ROBOT_PARTICIPANT).addParticipant(ALEX);
      }
    };
    when(operationRegistry.getServiceFor(any(OperationType.class))).thenReturn(service);

    OperationRequest operation = new OperationRequest("wavelet.create", "op1");
    List<OperationRequest> operations = Collections.singletonList(operation);

    applicator.applyOperations(operations, waveletData, hashedVersionZero, ACCOUNT);

    verify(operationRegistry).getServiceFor(any(OperationType.class));
View Full Code Here

TOP

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

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.