use of software.amazon.awssdk.enhanced.dynamodb.model.BatchGetResultPageIterable in project aws-sdk-java-v2 by aws.
the class BatchGetItemTest method getRecordsFromMultipleTables_viaFlattenedItems.
@Test
public void getRecordsFromMultipleTables_viaFlattenedItems() {
insertRecords();
BatchGetResultPageIterable results = getBatchGetResultPagesForBothTables();
SdkIterable<Record1> recordsList1 = results.resultsForTable(mappedTable1);
assertThat(recordsList1, containsInAnyOrder(RECORDS_1.toArray()));
SdkIterable<Record2> recordsList2 = results.resultsForTable(mappedTable2);
assertThat(recordsList2, containsInAnyOrder(RECORDS_2.toArray()));
}
use of software.amazon.awssdk.enhanced.dynamodb.model.BatchGetResultPageIterable in project aws-sdk-java-v2 by aws.
the class BatchGetItemTest method successfulResponseWithoutUnprocessedKeys_NoNextPage_viaFlattenedItems.
@Test
public void successfulResponseWithoutUnprocessedKeys_NoNextPage_viaFlattenedItems() {
stubSuccessfulResponse();
BatchGetResultPageIterable batchGetResultPages = enhancedClient.batchGetItem(r -> r.readBatches(ReadBatch.builder(Record.class).mappedTableResource(table).addGetItem(i -> i.key(k -> k.partitionValue(0))).build()));
assertThat(batchGetResultPages.resultsForTable(table)).hasSize(3);
}
use of software.amazon.awssdk.enhanced.dynamodb.model.BatchGetResultPageIterable in project aws-sdk-java-v2 by aws.
the class BatchGetItemTest method responseWithUnprocessedKeys_iterateItems_shouldFetchUnprocessedKeys.
@Test
public void responseWithUnprocessedKeys_iterateItems_shouldFetchUnprocessedKeys() {
stubResponseWithUnprocessedKeys();
BatchGetResultPageIterable batchGetResultPages = enhancedClient.batchGetItem(r -> r.readBatches(ReadBatch.builder(Record.class).mappedTableResource(table).addGetItem(i -> i.key(k -> k.partitionValue("1"))).build()));
SdkIterable<Record> results = batchGetResultPages.resultsForTable(table);
assertThat(results.stream().count()).isEqualTo(3);
}
use of software.amazon.awssdk.enhanced.dynamodb.model.BatchGetResultPageIterable in project aws-sdk-java-v2 by aws.
the class BatchGetItemTest method notFoundRecordIgnored_viaFlattenedItems.
@Test
public void notFoundRecordIgnored_viaFlattenedItems() {
insertRecords();
BatchGetItemEnhancedRequest batchGetItemEnhancedRequest = batchGetItemEnhancedRequestWithNotFoundRecord();
BatchGetResultPageIterable pageIterable = enhancedClient.batchGetItem(batchGetItemEnhancedRequest);
assertThat(pageIterable.stream().count(), is(1L));
List<Record1> recordsList1 = pageIterable.resultsForTable(mappedTable1).stream().collect(Collectors.toList());
assertThat(recordsList1, is(RECORDS_1.subList(0, 1)));
SdkIterable<Record2> recordsList2 = pageIterable.resultsForTable(mappedTable2);
assertThat(recordsList2, containsInAnyOrder(RECORDS_2.toArray()));
}
Aggregations