use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class EventTypeDbRepositoryTest method unknownAttributesAreIgnoredWhenDesserializing.
@Test
public void unknownAttributesAreIgnoredWhenDesserializing() throws Exception {
final EventType eventType = buildDefaultEventType();
final ObjectNode node = (ObjectNode) TestUtils.OBJECT_MAPPER.readTree(TestUtils.OBJECT_MAPPER.writeValueAsString(eventType));
node.set("unknown_attribute", new TextNode("will just be ignored"));
final String eventTypeName = eventType.getName();
final String insertSQL = "INSERT INTO zn_data.event_type (et_name, et_event_type_object) " + "VALUES (?, to_json(?::json))";
template.update(insertSQL, eventTypeName, TestUtils.OBJECT_MAPPER.writeValueAsString(node));
final EventType persistedEventType = repository.findByName(eventTypeName);
assertThat(persistedEventType, notNullValue());
}
use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class EventTypeDbRepositoryTest method whenCreateDuplicatedNamesThrowAnError.
@Test(expected = DuplicatedEventTypeNameException.class)
public void whenCreateDuplicatedNamesThrowAnError() throws Exception {
final EventType eventType = buildDefaultEventType();
repository.saveEventType(eventType);
repository.saveEventType(eventType);
}
use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class EventTypeDbRepositoryTest method whenUpdateDifferentSchemaVersionThenInsertIt.
@Test
public void whenUpdateDifferentSchemaVersionThenInsertIt() throws NakadiException, IOException {
final EventType eventType = buildDefaultEventType();
repository.saveEventType(eventType);
eventType.getSchema().setVersion(new Version("1.1.0"));
repository.update(eventType);
final int rows = template.queryForObject("SELECT count(*) FROM zn_data.event_type_schema where ets_event_type_name=?", Integer.class, eventType.getName());
assertThat("Number of rows should increase", rows, equalTo(2));
}
use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class PartitionsControllerAT method testBeginShownForNoEvents.
@Test
public void testBeginShownForNoEvents() throws IOException {
final EventType eventType = NakadiTestUtils.createEventType();
when().get(String.format("/event-types/%s/partitions", eventType.getName())).then().statusCode(HttpStatus.OK.value()).body("oldest_available_offset[0]", equalTo("001-0001-000000000000000000")).body("newest_available_offset[0]", equalTo("001-0001--1"));
when().get(String.format("/event-types/%s/partitions/%d", eventType.getName(), 0)).then().statusCode(HttpStatus.OK.value()).body("oldest_available_offset", equalTo("001-0001-000000000000000000")).body("newest_available_offset", equalTo("001-0001--1"));
}
use of org.zalando.nakadi.domain.EventType in project nakadi by zalando.
the class SettingsControllerAT method testGetFlooders.
@Test
public void testGetFlooders() throws Exception {
final EventType eventType = NakadiTestUtils.createEventType();
blacklist(eventType.getName(), BlacklistService.Type.CONSUMER_ET);
TestUtils.waitFor(() -> given().contentType(ContentType.JSON).get(BLACKLIST_URL).then().statusCode(HttpStatus.SC_OK).body("consumers.event_types", hasItems(eventType.getName())), 1000, 200);
}
Aggregations