Search in sources :

Example 6 with ErrorResponse

use of io.zeebe.test.broker.protocol.clientapi.ErrorResponse in project zeebe by zeebe-io.

the class TaskSubscriptionTest method shouldRejectSubscriptionWithNegativeLockDuration.

@Test
public void shouldRejectSubscriptionWithNegativeLockDuration() {
    // given
    final ControlMessageRequestBuilder request = apiRule.createControlMessageRequest().messageType(ControlMessageType.ADD_TASK_SUBSCRIPTION).partitionId(apiRule.getDefaultPartitionId()).data().put("taskType", "foo").put("lockDuration", -1).put("lockOwner", "bar").put("credits", 5).done();
    // when
    final ErrorResponse errorResponse = request.send().awaitError();
    // then
    assertThat(errorResponse).isNotNull();
    assertThat(errorResponse.getErrorCode()).isEqualTo(ErrorCode.REQUEST_PROCESSING_FAILURE);
    assertThat(errorResponse.getErrorData()).isEqualTo("Cannot add task subscription. lock duration must be greater than 0");
}
Also used : ControlMessageRequestBuilder(io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder) ErrorResponse(io.zeebe.test.broker.protocol.clientapi.ErrorResponse) Test(org.junit.Test)

Example 7 with ErrorResponse

use of io.zeebe.test.broker.protocol.clientapi.ErrorResponse in project zeebe by zeebe-io.

the class TaskSubscriptionTest method shouldRejectSubscriptionWithoutLockOwner.

@Test
public void shouldRejectSubscriptionWithoutLockOwner() {
    // given
    final ControlMessageRequestBuilder request = apiRule.createControlMessageRequest().messageType(ControlMessageType.ADD_TASK_SUBSCRIPTION).partitionId(apiRule.getDefaultPartitionId()).data().put("taskType", "foo").put("lockDuration", 10000L).put("credits", 5).done();
    // when
    final ErrorResponse errorResponse = request.send().awaitError();
    // then
    assertThat(errorResponse).isNotNull();
    assertThat(errorResponse.getErrorCode()).isEqualTo(ErrorCode.REQUEST_PROCESSING_FAILURE);
    assertThat(errorResponse.getErrorData()).isEqualTo("Cannot add task subscription. lock owner must not be empty");
}
Also used : ControlMessageRequestBuilder(io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder) ErrorResponse(io.zeebe.test.broker.protocol.clientapi.ErrorResponse) Test(org.junit.Test)

Example 8 with ErrorResponse

use of io.zeebe.test.broker.protocol.clientapi.ErrorResponse in project zeebe by zeebe-io.

the class TaskSubscriptionTest method shouldRejectNegativeCredits.

@Test
public void shouldRejectNegativeCredits() {
    // when
    final ErrorResponse error = apiRule.createControlMessageRequest().messageType(ControlMessageType.INCREASE_TASK_SUBSCRIPTION_CREDITS).data().put("subscriberKey", 1).put("credits", -10).put("partitionId", apiRule.getDefaultPartitionId()).done().send().awaitError();
    // then
    assertThat(error.getErrorCode()).isEqualTo(ErrorCode.REQUEST_PROCESSING_FAILURE);
    assertThat(error.getErrorData()).isEqualTo("Cannot increase task subscription credits. Credits must be positive.");
}
Also used : ErrorResponse(io.zeebe.test.broker.protocol.clientapi.ErrorResponse) Test(org.junit.Test)

Example 9 with ErrorResponse

use of io.zeebe.test.broker.protocol.clientapi.ErrorResponse in project zeebe by zeebe-io.

the class TaskSubscriptionTest method shouldRejectSubscriptionWithZeroLockDuration.

@Test
public void shouldRejectSubscriptionWithZeroLockDuration() {
    // given
    final ControlMessageRequestBuilder request = apiRule.createControlMessageRequest().messageType(ControlMessageType.ADD_TASK_SUBSCRIPTION).partitionId(apiRule.getDefaultPartitionId()).data().put("taskType", "foo").put("lockDuration", 0).put("lockOwner", "bar").put("credits", 5).done();
    // when
    final ErrorResponse errorResponse = request.send().awaitError();
    // then
    assertThat(errorResponse).isNotNull();
    assertThat(errorResponse.getErrorCode()).isEqualTo(ErrorCode.REQUEST_PROCESSING_FAILURE);
    assertThat(errorResponse.getErrorData()).isEqualTo("Cannot add task subscription. lock duration must be greater than 0");
}
Also used : ControlMessageRequestBuilder(io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder) ErrorResponse(io.zeebe.test.broker.protocol.clientapi.ErrorResponse) Test(org.junit.Test)

Aggregations

ErrorResponse (io.zeebe.test.broker.protocol.clientapi.ErrorResponse)9 Test (org.junit.Test)9 ControlMessageRequestBuilder (io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder)6