use of io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder in project zeebe by zeebe-io.
the class TaskSubscriptionTest method shouldRejectSubscriptionWithExcessiveLockOwnerName.
@Test
public void shouldRejectSubscriptionWithExcessiveLockOwnerName() {
// given
final String lockOwner = StringUtil.stringOfLength(TaskSubscription.LOCK_OWNER_MAX_LENGTH + 1);
final ControlMessageRequestBuilder request = apiRule.createControlMessageRequest().messageType(ControlMessageType.ADD_TASK_SUBSCRIPTION).partitionId(apiRule.getDefaultPartitionId()).data().put("taskType", "foo").put("lockDuration", 10000L).put("lockOwner", lockOwner).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. length of lock owner must be less than or equal to 64");
}
use of io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder in project zeebe by zeebe-io.
the class TaskSubscriptionTest method shouldRejectSubscriptionWithZeroCredits.
@Test
public void shouldRejectSubscriptionWithZeroCredits() {
// given
final ControlMessageRequestBuilder request = apiRule.createControlMessageRequest().messageType(ControlMessageType.ADD_TASK_SUBSCRIPTION).partitionId(apiRule.getDefaultPartitionId()).data().put("taskType", "foo").put("lockDuration", 10000L).put("lockOwner", "bar").put("credits", 0).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. subscription credits must be greater than 0");
}
use of io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder in project zeebe by zeebe-io.
the class TaskSubscriptionTest method shouldRejectSubscriptionWithNegativeCredits.
@Test
public void shouldRejectSubscriptionWithNegativeCredits() {
// given
final ControlMessageRequestBuilder request = apiRule.createControlMessageRequest().messageType(ControlMessageType.ADD_TASK_SUBSCRIPTION).partitionId(apiRule.getDefaultPartitionId()).data().put("taskType", "foo").put("lockDuration", 10000L).put("lockOwner", "bar").put("credits", -1).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. subscription credits must be greater than 0");
}
use of io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder in project zeebe by zeebe-io.
the class TaskSubscriptionTest method shouldIgnoreCreditsRequestIfSubscriptionDoesNotExist.
@Test
public void shouldIgnoreCreditsRequestIfSubscriptionDoesNotExist() {
// given
final int nonExistingSubscriberKey = 444;
final ControlMessageRequestBuilder request = apiRule.createControlMessageRequest().messageType(ControlMessageType.INCREASE_TASK_SUBSCRIPTION_CREDITS).partitionId(apiRule.getDefaultPartitionId()).data().put("subscriberKey", nonExistingSubscriberKey).put("credits", 2).put("partitionId", apiRule.getDefaultPartitionId()).done();
// when
final ControlMessageResponse response = request.sendAndAwait();
// then
assertThat(response.getData()).containsEntry("subscriberKey", nonExistingSubscriberKey);
}
use of io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder 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");
}
Aggregations