use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class EventTypeAT method assertRetentionTime.
private void assertRetentionTime(final Long checkingRetentionTime, final String etName) throws IOException {
final EventType eventType = NakadiTestUtils.getEventType(etName);
Assert.assertEquals(checkingRetentionTime, eventType.getOptions().getRetentionTime());
TIMELINE_REPOSITORY.listTimelinesOrdered(eventType.getName()).stream().map(Timeline::getTopic).forEach(topic -> waitFor(() -> Assert.assertEquals(checkingRetentionTime, KafkaTestHelper.getTopicRetentionTime(topic, ZOOKEEPER_URL))));
}
use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class EventTypeAT method whenDELETEEventTypeThenOK.
@Test
public void whenDELETEEventTypeThenOK() throws JsonProcessingException, NoSuchEventTypeException {
// ARRANGE //
final EventType eventType = buildDefaultEventType();
postEventType(eventType);
final List<String> topics = getTopicsForEventType(eventType.getName());
// ACT //
deleteEventTypeAndOK(eventType);
// ASSERT //
checkEventTypeIsDeleted(eventType, topics);
}
use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class EventTypeAT method whenDELETEEventTypeWithOneTimelineThenOK.
@Test
public void whenDELETEEventTypeWithOneTimelineThenOK() throws JsonProcessingException, NoSuchEventTypeException {
final EventType eventType = buildDefaultEventType();
postEventType(eventType);
postTimeline(eventType);
final List<String> topics = getTopicsForEventType(eventType.getName());
// ACT //
deleteEventTypeAndOK(eventType);
// ASSERT //
checkEventTypeIsDeleted(eventType, topics);
}
use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class EventTypeAT method whenUpdateETAuthObjectThen422.
@Test
public void whenUpdateETAuthObjectThen422() throws Exception {
final ResourceAuthorization auth = new ResourceAuthorization(Collections.singletonList(new ResourceAuthorizationAttribute("type1", "value1")), Collections.singletonList(new ResourceAuthorizationAttribute("type2", "value2")), Collections.singletonList(new ResourceAuthorizationAttribute("type3", "value3")));
final EventType eventType = EventTypeTestBuilder.builder().authorization(auth).build();
NakadiTestUtils.createEventTypeInNakadi(eventType);
eventType.setAuthorization(null);
given().body(MAPPER.writeValueAsString(eventType)).contentType(JSON).put("/event-types/" + eventType.getName()).then().statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY).body(equalTo(MAPPER.writer().writeValueAsString(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, "Changing authorization object to `null` is not possible due to existing one"))));
}
use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class EventTypeAT method whenUpdatePartitioningStrategyToNonExistingStrategyThen422.
@Test
public void whenUpdatePartitioningStrategyToNonExistingStrategyThen422() throws JsonProcessingException {
final EventType eventType = buildDefaultEventType();
final String bodyRandom = MAPPER.writer().writeValueAsString(eventType);
given().body(bodyRandom).header("accept", "application/json").contentType(JSON).post(ENDPOINT);
eventType.setPartitionStrategy("random1");
final String bodyUserDefined = MAPPER.writer().writeValueAsString(eventType);
given().body(bodyUserDefined).header("accept", "application/json").contentType(JSON).put(ENDPOINT + "/" + eventType.getName()).then().statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY);
}
Aggregations