use of org.zalando.nakadi.domain.EventPublishResult in project nakadi by zalando.
the class EventPublisherTest method whenPublishIsSuccessfulThenResultIsSubmitted.
@Test
public void whenPublishIsSuccessfulThenResultIsSubmitted() throws Exception {
final EventType eventType = buildDefaultEventType();
final JSONArray batch = buildDefaultBatch(1);
mockSuccessfulValidation(eventType);
final EventPublishResult result = publisher.publish(batch.toString(), eventType.getName());
assertThat(result.getStatus(), equalTo(EventPublishingStatus.SUBMITTED));
verify(topicRepository, times(1)).syncPostBatch(any(), any());
}
use of org.zalando.nakadi.domain.EventPublishResult in project nakadi by zalando.
the class EventPublisherTest method whenEventIsOneByteOverMaxSizeWithMultiByteCharsThenResultIsAborted.
@Test
public void whenEventIsOneByteOverMaxSizeWithMultiByteCharsThenResultIsAborted() throws Exception {
final EventType eventType = buildDefaultEventType();
final JSONArray batch = buildOneByteTooLargeBatchMultiByte(1);
mockSuccessfulValidation(eventType);
final EventPublishResult result = publisher.publish(batch.toString(), eventType.getName());
assertThat(result.getStatus(), equalTo(EventPublishingStatus.ABORTED));
verify(enrichment, times(0)).enrich(any(), any());
verify(partitionResolver, times(0)).resolvePartition(any(), any());
verify(topicRepository, times(0)).syncPostBatch(any(), any());
}
use of org.zalando.nakadi.domain.EventPublishResult in project nakadi by zalando.
the class EventPublisherTest method whenEventIsExactlyMaxSizeWithMultiByteCharsThenResultIsSuccess.
@Test
public void whenEventIsExactlyMaxSizeWithMultiByteCharsThenResultIsSuccess() throws Exception {
final EventType eventType = buildDefaultEventType();
final JSONArray batch = buildMaxSizeBatchMultiByte(1);
mockSuccessfulValidation(eventType);
final EventPublishResult result = publisher.publish(batch.toString(), eventType.getName());
assertThat(result.getStatus(), equalTo(EventPublishingStatus.SUBMITTED));
verify(enrichment, times(1)).enrich(any(), any());
verify(partitionResolver, times(1)).resolvePartition(any(), any());
verify(topicRepository, times(1)).syncPostBatch(any(), any());
}
Aggregations