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");
}
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");
}
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.");
}
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");
}
Aggregations