Search in sources :

Example 1 with CancelProcessInstanceRequest

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest in project zeebe by camunda.

the class CancelProcessInstanceCommandImpl method send.

@Override
public ZeebeFuture<CancelProcessInstanceResponse> send() {
    final CancelProcessInstanceRequest request = builder.build();
    final RetriableClientFutureImpl<CancelProcessInstanceResponse, GatewayOuterClass.CancelProcessInstanceResponse> future = new RetriableClientFutureImpl<>(CancelProcessInstanceResponseImpl::new, retryPredicate, streamObserver -> send(request, streamObserver));
    send(request, future);
    return future;
}
Also used : CancelProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest) RetriableClientFutureImpl(io.camunda.zeebe.client.impl.RetriableClientFutureImpl) CancelProcessInstanceResponseImpl(io.camunda.zeebe.client.impl.response.CancelProcessInstanceResponseImpl) CancelProcessInstanceResponse(io.camunda.zeebe.client.api.response.CancelProcessInstanceResponse)

Example 2 with CancelProcessInstanceRequest

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest in project zeebe by camunda.

the class CancelProcessInstanceTest method shouldMapRequestAndResponse.

@Test
public void shouldMapRequestAndResponse() {
    // given
    final CancelProcessInstanceStub stub = new CancelProcessInstanceStub();
    stub.registerWith(brokerClient);
    final CancelProcessInstanceRequest request = CancelProcessInstanceRequest.newBuilder().setProcessInstanceKey(123).build();
    // when
    final CancelProcessInstanceResponse response = client.cancelProcessInstance(request);
    // then
    assertThat(response).isNotNull();
    final BrokerCancelProcessInstanceRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getKey()).isEqualTo(123);
    assertThat(brokerRequest.getIntent()).isEqualTo(ProcessInstanceIntent.CANCEL);
    assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.PROCESS_INSTANCE);
}
Also used : CancelProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest) BrokerCancelProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCancelProcessInstanceRequest) BrokerCancelProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCancelProcessInstanceRequest) CancelProcessInstanceResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 3 with CancelProcessInstanceRequest

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest in project zeebe by camunda-cloud.

the class CancelProcessInstanceCommandImpl method send.

@Override
public ZeebeFuture<CancelProcessInstanceResponse> send() {
    final CancelProcessInstanceRequest request = builder.build();
    final RetriableClientFutureImpl<CancelProcessInstanceResponse, GatewayOuterClass.CancelProcessInstanceResponse> future = new RetriableClientFutureImpl<>(CancelProcessInstanceResponseImpl::new, retryPredicate, streamObserver -> send(request, streamObserver));
    send(request, future);
    return future;
}
Also used : CancelProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest) RetriableClientFutureImpl(io.camunda.zeebe.client.impl.RetriableClientFutureImpl) CancelProcessInstanceResponseImpl(io.camunda.zeebe.client.impl.response.CancelProcessInstanceResponseImpl) CancelProcessInstanceResponse(io.camunda.zeebe.client.api.response.CancelProcessInstanceResponse)

Example 4 with CancelProcessInstanceRequest

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest in project zeebe by camunda-cloud.

the class CancelProcessInstanceTest method shouldSendCancelCommand.

@Test
public void shouldSendCancelCommand() {
    // when
    client.newCancelInstanceCommand(123).send().join();
    // then
    final CancelProcessInstanceRequest request = gatewayService.getLastRequest();
    assertThat(request.getProcessInstanceKey()).isEqualTo(123);
    rule.verifyDefaultRequestTimeout();
}
Also used : CancelProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 5 with CancelProcessInstanceRequest

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest in project zeebe by camunda-cloud.

the class CancelProcessInstanceTest method shouldMapRequestAndResponse.

@Test
public void shouldMapRequestAndResponse() {
    // given
    final CancelProcessInstanceStub stub = new CancelProcessInstanceStub();
    stub.registerWith(brokerClient);
    final CancelProcessInstanceRequest request = CancelProcessInstanceRequest.newBuilder().setProcessInstanceKey(123).build();
    // when
    final CancelProcessInstanceResponse response = client.cancelProcessInstance(request);
    // then
    assertThat(response).isNotNull();
    final BrokerCancelProcessInstanceRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getKey()).isEqualTo(123);
    assertThat(brokerRequest.getIntent()).isEqualTo(ProcessInstanceIntent.CANCEL);
    assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.PROCESS_INSTANCE);
}
Also used : CancelProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest) BrokerCancelProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCancelProcessInstanceRequest) BrokerCancelProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCancelProcessInstanceRequest) CancelProcessInstanceResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Aggregations

CancelProcessInstanceRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest)9 Test (org.junit.Test)6 CancelProcessInstanceResponse (io.camunda.zeebe.client.api.response.CancelProcessInstanceResponse)3 RetriableClientFutureImpl (io.camunda.zeebe.client.impl.RetriableClientFutureImpl)3 CancelProcessInstanceResponseImpl (io.camunda.zeebe.client.impl.response.CancelProcessInstanceResponseImpl)3 ClientTest (io.camunda.zeebe.client.util.ClientTest)3 GatewayTest (io.camunda.zeebe.gateway.api.util.GatewayTest)3 BrokerCancelProcessInstanceRequest (io.camunda.zeebe.gateway.impl.broker.request.BrokerCancelProcessInstanceRequest)3 CancelProcessInstanceResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceResponse)3