Search in sources :

Example 6 with ControlMessageRequestBuilder

use of io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder 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 7 with ControlMessageRequestBuilder

use of io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder 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

ControlMessageRequestBuilder (io.zeebe.test.broker.protocol.clientapi.ControlMessageRequestBuilder)7 Test (org.junit.Test)7 ErrorResponse (io.zeebe.test.broker.protocol.clientapi.ErrorResponse)6 ControlMessageResponse (io.zeebe.test.broker.protocol.clientapi.ControlMessageResponse)1