Examples of OperationService


Examples of com.hazelcast.spi.OperationService

    private MultiMapResponse lockAndGet(Data key, long timeout, long ttl) {
        final NodeEngine nodeEngine = getNodeEngine();
        TxnLockAndGetOperation operation = new TxnLockAndGetOperation(name, key, timeout, ttl, getThreadId());
        try {
            int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
            final OperationService operationService = nodeEngine.getOperationService();
            Future<MultiMapResponse> f = operationService.
                    invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
            return f.get();
        } catch (Throwable t) {
            throw ExceptionUtil.rethrow(t);
        }
View Full Code Here

Examples of com.hazelcast.spi.OperationService

    private long nextId(Data key) {
        final NodeEngine nodeEngine = getNodeEngine();
        TxnGenerateRecordIdOperation operation = new TxnGenerateRecordIdOperation(name, key);
        try {
            int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
            final OperationService operationService = nodeEngine.getOperationService();
            Future<Long> f = operationService.invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
            return f.get();
        } catch (Throwable t) {
            throw ExceptionUtil.rethrow(t);
        }
    }
View Full Code Here

Examples of org.waveprotocol.box.server.robots.operations.OperationService

    when(robotSerializer.deserializeOperations(anyString())).thenReturn(operations);
    String responseValue = "response value";
    when(robotSerializer.serialize(any(), any(Type.class), any(ProtocolVersion.class))).thenReturn(
        responseValue);

    OperationService service = mock(OperationService.class);
    when(operationRegistry.getServiceFor(any(OperationType.class))).thenReturn(service);

    servlet.doPost(req, resp);

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

Examples of org.waveprotocol.box.server.robots.operations.OperationService

  public void testRegister() throws Exception {
    OperationType operationType = OperationType.BLIP_CONTINUE_THREAD;
    DoNothingService doNothingService = DoNothingService.create();
    operationAccessor.register(operationType, doNothingService);
    OperationService service = operationAccessor.getServiceFor(operationType);
    assertEquals(doNothingService, service);
  }
View Full Code Here

Examples of org.waveprotocol.box.server.robots.operations.OperationService

    hashedVersionZero = HASH_FACTORY.createVersionZero(WAVELET_NAME);
  }

  public void testapplyOperationsExecutesAndSubmitsDelta() throws Exception {
    // Use a special operation service that generates a simple delta;
    OperationService service = new OperationService() {
      @Override
      public void execute(
          OperationRequest operation, OperationContext context, ParticipantId participant)
          throws InvalidRequestException {
        context.openWavelet(WAVE_ID, WAVELET_ID, ROBOT_PARTICIPANT).addParticipant(ALEX);
View Full Code Here

Examples of org.waveprotocol.box.server.robots.operations.OperationService

    when(robotSerializer.serialize(any(), any(Type.class), any(ProtocolVersion.class))).thenReturn(
        responseValue);
    Map<String, String[]> params = getOAuthParams();
    when(req.getParameterMap()).thenReturn(params);

    OperationService service = mock(OperationService.class);
    when(operationRegistry.getServiceFor(any(OperationType.class))).thenReturn(service);

    servlet.doPost(req, resp);

    verify(validator).validateMessage(any(OAuthMessage.class), any(OAuthAccessor.class));
View Full Code Here

Examples of org.waveprotocol.box.server.robots.operations.OperationService

  public void testExecuteOperationCallsExecute() throws Exception {
    String operationId = "op1";
    OperationRequest operation = new OperationRequest("wavelet.create", operationId);

    OperationService service = mock(OperationService.class);
    when(operationRegistry.getServiceFor(any(OperationType.class))).thenReturn(service);

    OperationUtil.executeOperation(operation, operationRegistry, context, ALEX);

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

Examples of org.waveprotocol.box.server.robots.operations.OperationService

  public void testExecuteOperationsSetsErrorOnInvalidRequestException() throws Exception {
    String operationId = "op1";
    OperationRequest operation = new OperationRequest("wavelet.create", operationId);

    OperationService service =
        mock(OperationService.class, new ThrowsException(new InvalidRequestException("")));
    when(operationRegistry.getServiceFor(any(OperationType.class))).thenReturn(service);

    OperationUtil.executeOperation(operation, operationRegistry, context, ALEX);
View Full Code Here

Examples of org.waveprotocol.box.server.robots.operations.OperationService

   * @param author the author of the operation.
   */
  public static void executeOperation(OperationRequest operation,
      OperationServiceRegistry operationRegistry, OperationContext context, ParticipantId author) {
    try {
      OperationService service =
          operationRegistry.getServiceFor(OperationUtil.getOperationType(operation));
      ParticipantId proxyParticipant = OperationUtil.computeParticipant(operation, author);
      service.execute(operation, context, proxyParticipant);
    } catch (InvalidRequestException e) {
      LOG.warning("Operation " + operation + " failed to execute", e);
      context.constructErrorResponse(operation, e.getMessage());
    }
  }
View Full Code Here

Examples of org.waveprotocol.box.server.robots.operations.OperationService

  public AbstractOperationServiceRegistry() {
  }

  @Override
  public final OperationService getServiceFor(OperationType opType) throws InvalidRequestException {
    OperationService service = operationMap.get(opType);
    if (service == null) {
      throw new InvalidRequestException("No OperationService found for " + opType);
    }
    return service;
  }
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.