Examples of OperationContextImpl


Examples of org.waveprotocol.box.server.robots.OperationContextImpl

    when(waveletData.getWaveId()).thenReturn(TEMP_WAVE_ID);
    when(waveletData.getWaveletId()).thenReturn(WAVELET_ID);
    when(waveletData.getRootBlipId()).thenReturn("b+root");

    ConversationUtil conversationUtil = new ConversationUtil(FakeIdGenerator.create());
    context = new OperationContextImpl(waveletProvider, converter, conversationUtil);

    operation =
        new OperationRequest(OperationType.ROBOT_CREATE_WAVELET.method(), OPERATION_ID,
            Parameter.of(ParamsProperty.WAVELET_DATA, waveletData),
            Parameter.of(ParamsProperty.MESSAGE, MESSAGE));
View Full Code Here

Examples of org.waveprotocol.box.server.robots.OperationContextImpl

    blipData = new BlipData(s(WAVE_ID), s(WAVELET_ID), TEMP_BLIP_ID, NEW_BLIP_CONTENT);
    blipData.setBlipId(TEMP_BLIP_ID);
  }

  public void testAddParticipant() throws Exception {
    OperationContextImpl context = helper.getContext();
    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot();
    String rootBlipId = ConversationUtil.getRootBlipId(conversation);

    // Confirm alex is not on wave prior to operation.
    Set<ParticipantId> participants = conversation.getParticipantIds();
    assertFalse("Alex should not be a participant on wavelet prior to operation to add him.",
        participants.contains(ALEX));

    OperationRequest operation =
        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

Examples of org.waveprotocol.box.server.robots.OperationContextImpl

    participants = conversation.getParticipantIds();
    assertTrue("Alex should now be a participant on the wavelet.", participants.contains(ALEX));
  }

  public void testAddThrowsOnDuplicateParticipant() throws Exception {
    OperationContextImpl context = helper.getContext();
    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot();
    String rootBlipId = ConversationUtil.getRootBlipId(conversation);

    // Confirm robot is on wave prior to operation to re-add it.
    Set<ParticipantId> participants = conversation.getParticipantIds();
    assertTrue("Robot should be a participant on wavelet prior to test operation to add it.",
View Full Code Here

Examples of org.waveprotocol.box.server.robots.OperationContextImpl

      // Good.
    }
  }

  public void testRemoveParticipant() throws Exception {
    OperationContextImpl context = helper.getContext();
    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot();
    String rootBlipId = ConversationUtil.getRootBlipId(conversation);

    // Confirm alex is not on wave prior to operation.
    Set<ParticipantId> participants = conversation.getParticipantIds();
    assertFalse("Alex should not be a participant on wavelet prior to operation to add him.",
View Full Code Here

Examples of org.waveprotocol.box.server.robots.OperationContextImpl

    assertFalse("Alex should no longer be a participant on the wavelet.",
        participants.contains(ALEX));
  }

  public void testRemoveThrowsOnNonWaveletParticipant() throws Exception {
    OperationContextImpl context = helper.getContext();
    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot();
    String rootBlipId = ConversationUtil.getRootBlipId(conversation);

    // Confirm alex is not on wave prior to operation.
    Set<ParticipantId> participants = conversation.getParticipantIds();
    assertFalse("Alex should not be a participant on wavelet prior to operation to add him.",
View Full Code Here

Examples of org.waveprotocol.box.server.robots.OperationContextImpl

      // Good.
    }
  }

  public void testInvalidParticipantAddress() throws Exception {
    OperationContextImpl context = helper.getContext();
    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot();
    String rootBlipId = ConversationUtil.getRootBlipId(conversation);

    OperationRequest operation =
        operationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, rootBlipId,
            Parameter.of(ParamsProperty.PARTICIPANT_ID, MALFORMED_ADDRESS));
View Full Code Here

Examples of org.waveprotocol.box.server.robots.OperationContextImpl

    WaveletBasedConversation.makeWaveletConversational(wavelet);
    ConversationUtil conversationUtil = new ConversationUtil(FakeIdGenerator.create());
    ObservableConversation conversation = conversationUtil.buildConversation(wavelet).getRoot();
    conversation.getRootThread().appendBlip();

    context = new OperationContextImpl(waveletProvider, converter, conversationUtil);
    context.putWavelet(waveletName.waveId, waveletName.waveletId,
        new RobotWaveletData(waveletData, HASH_FACTORY.createVersionZero(waveletName)));
  }
View Full Code Here

Examples of org.waveprotocol.box.server.robots.OperationContextImpl

      return;
    }

    // Create an unbound context.
    ProtocolVersion version = OperationUtil.getProtocolVersion(operations);
    OperationContextImpl context = new OperationContextImpl(
        waveletProvider, converterManager.getEventDataConverter(version), conversationUtil);

    executeOperations(context, operations, participant);
    handleResults(context, resp, version);
  }
View Full Code Here

Examples of org.waveprotocol.box.server.robots.OperationContextImpl

      HashedVersion hashedVersion, RobotAccountData account) {
    // The robots we support should be sending us their version in their first
    // operation
    ProtocolVersion protocolVersion = OperationUtil.getProtocolVersion(operations);

    OperationContextImpl context = new OperationContextImpl(waveletProvider,
        converterManager.getEventDataConverter(protocolVersion), conversationUtil,
        new RobotWaveletData(wavelet, hashedVersion));

    executeOperations(context, operations, account);
    handleResults(context, account);
View Full Code Here

Examples of org.waveprotocol.box.server.robots.OperationContextImpl

   */
  protected SearchResult performSearch(SearchRequest searchRequest, ParticipantId user) {
    OperationQueue opQueue = new OperationQueue();
    opQueue.search(searchRequest.getQuery(), searchRequest.getIndex(),
        searchRequest.getNumResults());
    OperationContextImpl context =
        new OperationContextImpl(waveletProvider,
            converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
    LOG.fine(
        "Performing query: " + searchRequest.getQuery() + " [" + searchRequest.getIndex() + ", "
            + (searchRequest.getIndex() + searchRequest.getNumResults()) + "]");
    OperationRequest operationRequest = opQueue.getPendingOperations().get(0);
    String opId = operationRequest.getId();
    OperationUtil.executeOperation(operationRequest, operationRegistry, context, user);
    JsonRpcResponse jsonRpcResponse = context.getResponses().get(opId);
    SearchResult searchResult =
        (SearchResult) jsonRpcResponse.getData().get(ParamsProperty.SEARCH_RESULTS);
    return searchResult;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.