use of org.zalando.nakadi.domain.ItemsWrapper in project nakadi by zalando.
the class CursorsControllerTest method whenCommitInvalidCursorsThenOk.
@Test
public void whenCommitInvalidCursorsThenOk() throws Exception {
when(cursorsService.commitCursors(any(), any(), any())).thenReturn(DUMMY_CURSORS.stream().map(v -> Boolean.FALSE).collect(Collectors.toList()));
final ItemsWrapper<CursorCommitResult> expectation = new ItemsWrapper<>(DUMMY_CURSORS.stream().map(c -> new CursorCommitResult(c, false)).collect(Collectors.toList()));
postCursors(DUMMY_CURSORS).andExpect(status().isOk()).andExpect(content().string(TestUtils.JSON_TEST_HELPER.matchesObject(expectation)));
}
use of org.zalando.nakadi.domain.ItemsWrapper in project nakadi by zalando.
the class SubscriptionAT method whenStatsOnNotInitializedSubscriptionThanCorrectResponse.
@Test
public void whenStatsOnNotInitializedSubscriptionThanCorrectResponse() throws IOException {
final String et = createEventType().getName();
final Subscription s = createSubscriptionForEventType(et);
final Response response = when().get("/subscriptions/{sid}/stats", s.getId()).thenReturn();
final ItemsWrapper<SubscriptionEventTypeStats> statsItems = MAPPER.readValue(response.print(), new TypeReference<ItemsWrapper<SubscriptionEventTypeStats>>() {
});
Assert.assertEquals(1, statsItems.getItems().size());
final SubscriptionEventTypeStats stats = statsItems.getItems().get(0);
Assert.assertEquals(et, stats.getEventType());
Assert.assertEquals(1, stats.getPartitions().size());
for (final SubscriptionEventTypeStats.Partition partition : stats.getPartitions()) {
Assert.assertNotNull(partition);
Assert.assertNotNull(partition.getPartition());
Assert.assertEquals("", partition.getStreamId());
Assert.assertNull(partition.getUnconsumedEvents());
Assert.assertEquals(partition.getState(), "unassigned");
}
}
Aggregations