Search in sources :

Example 16 with ActivatedJob

use of io.camunda.zeebe.client.api.response.ActivatedJob in project zeebe by zeebe-io.

the class FailJobTest method shouldFailJob.

@Test
public void shouldFailJob() {
    // given
    final int newRetries = 23;
    final ActivatedJob job = Mockito.mock(ActivatedJob.class);
    Mockito.when(job.getKey()).thenReturn(12L);
    // when
    client.newFailCommand(job).retries(newRetries).send().join();
    // then
    final FailJobRequest request = gatewayService.getLastRequest();
    assertThat(request.getJobKey()).isEqualTo(job.getKey());
    assertThat(request.getRetries()).isEqualTo(newRetries);
}
Also used : ActivatedJob(io.camunda.zeebe.client.api.response.ActivatedJob) FailJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobRequest) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 17 with ActivatedJob

use of io.camunda.zeebe.client.api.response.ActivatedJob in project zeebe by zeebe-io.

the class JobUpdateRetriesTest method shouldUpdateRetries.

@Test
public void shouldUpdateRetries() {
    // given
    final int newRetries = 23;
    final ActivatedJob job = Mockito.mock(ActivatedJob.class);
    Mockito.when(job.getKey()).thenReturn(12L);
    // when
    client.newUpdateRetriesCommand(job).retries(newRetries).send().join();
    // then
    final UpdateJobRetriesRequest request = gatewayService.getLastRequest();
    assertThat(request.getJobKey()).isEqualTo(job.getKey());
    assertThat(request.getRetries()).isEqualTo(newRetries);
    rule.verifyDefaultRequestTimeout();
}
Also used : ActivatedJob(io.camunda.zeebe.client.api.response.ActivatedJob) UpdateJobRetriesRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.UpdateJobRetriesRequest) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 18 with ActivatedJob

use of io.camunda.zeebe.client.api.response.ActivatedJob in project zeebe by zeebe-io.

the class ThrowErrorTest method shouldThrowError.

@Test
public void shouldThrowError() {
    // given
    final String errorCode = "errorCode";
    final ActivatedJob job = Mockito.mock(ActivatedJob.class);
    Mockito.when(job.getKey()).thenReturn(12L);
    // when
    client.newThrowErrorCommand(job).errorCode(errorCode).send().join();
    // then
    final ThrowErrorRequest request = gatewayService.getLastRequest();
    assertThat(request.getJobKey()).isEqualTo(job.getKey());
    assertThat(request.getErrorCode()).isEqualTo(errorCode);
    rule.verifyDefaultRequestTimeout();
}
Also used : ActivatedJob(io.camunda.zeebe.client.api.response.ActivatedJob) ThrowErrorRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorRequest) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 19 with ActivatedJob

use of io.camunda.zeebe.client.api.response.ActivatedJob in project zeebe by camunda-cloud.

the class FailJobTest method shouldFailJob.

@Test
public void shouldFailJob() {
    // given
    final int newRetries = 23;
    final ActivatedJob job = Mockito.mock(ActivatedJob.class);
    Mockito.when(job.getKey()).thenReturn(12L);
    // when
    client.newFailCommand(job).retries(newRetries).send().join();
    // then
    final FailJobRequest request = gatewayService.getLastRequest();
    assertThat(request.getJobKey()).isEqualTo(job.getKey());
    assertThat(request.getRetries()).isEqualTo(newRetries);
}
Also used : ActivatedJob(io.camunda.zeebe.client.api.response.ActivatedJob) FailJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobRequest) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 20 with ActivatedJob

use of io.camunda.zeebe.client.api.response.ActivatedJob in project zeebe by camunda-cloud.

the class ThrowErrorTest method shouldThrowError.

@Test
public void shouldThrowError() {
    // given
    final String errorCode = "errorCode";
    final ActivatedJob job = Mockito.mock(ActivatedJob.class);
    Mockito.when(job.getKey()).thenReturn(12L);
    // when
    client.newThrowErrorCommand(job).errorCode(errorCode).send().join();
    // then
    final ThrowErrorRequest request = gatewayService.getLastRequest();
    assertThat(request.getJobKey()).isEqualTo(job.getKey());
    assertThat(request.getErrorCode()).isEqualTo(errorCode);
    rule.verifyDefaultRequestTimeout();
}
Also used : ActivatedJob(io.camunda.zeebe.client.api.response.ActivatedJob) ThrowErrorRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorRequest) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Aggregations

ActivatedJob (io.camunda.zeebe.client.api.response.ActivatedJob)46 Test (org.junit.Test)27 Bpmn (io.camunda.zeebe.model.bpmn.Bpmn)16 List (java.util.List)16 Test (org.junit.jupiter.api.Test)16 BrokerInfo (io.camunda.zeebe.client.api.response.BrokerInfo)14 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)14 ZeebeClient (io.camunda.zeebe.client.ZeebeClient)13 Duration (java.time.Duration)13 Awaitility (org.awaitility.Awaitility)13 ProcessInstanceEvent (io.camunda.zeebe.client.api.response.ProcessInstanceEvent)12 Map (java.util.Map)11 ActivateJobsResponse (io.camunda.zeebe.client.api.response.ActivateJobsResponse)9 DeploymentEvent (io.camunda.zeebe.client.api.response.DeploymentEvent)9 ZeebeFuture (io.camunda.zeebe.client.api.ZeebeFuture)8 ClientException (io.camunda.zeebe.client.api.command.ClientException)8 PartitionBrokerHealth (io.camunda.zeebe.client.api.response.PartitionBrokerHealth)8 PartitionBrokerRole (io.camunda.zeebe.client.api.response.PartitionBrokerRole)8 PartitionInfo (io.camunda.zeebe.client.api.response.PartitionInfo)8 Process (io.camunda.zeebe.client.api.response.Process)8