use of software.amazon.awssdk.enhanced.dynamodb.model.BatchGetResultPagePublisher in project aws-sdk-java-v2 by aws.
the class AsyncBatchGetItemTest method getRecordsFromMultipleTables_viaFlattenedItems.
@Test
public void getRecordsFromMultipleTables_viaFlattenedItems() {
insertRecords();
BatchGetResultPagePublisher publisher = batchGetResultPageSdkPublisherForBothTables();
List<Record1> table1Results = drainPublisher(publisher.resultsForTable(mappedTable1), 2);
assertThat(table1Results.size(), is(2));
assertThat(table1Results, containsInAnyOrder(RECORDS_1.toArray()));
List<Record2> table2Results = drainPublisher(publisher.resultsForTable(mappedTable2), 2);
assertThat(table1Results.size(), is(2));
assertThat(table2Results, containsInAnyOrder(RECORDS_2.toArray()));
}
use of software.amazon.awssdk.enhanced.dynamodb.model.BatchGetResultPagePublisher in project aws-sdk-java-v2 by aws.
the class AsyncBatchGetItemTest method successfulResponseWithoutUnprocessedKeys_viaFlattenedItems_NoNextPage.
@Test
public void successfulResponseWithoutUnprocessedKeys_viaFlattenedItems_NoNextPage() {
stubSuccessfulResponse();
BatchGetResultPagePublisher publisher = enhancedClient.batchGetItem(r -> r.readBatches(ReadBatch.builder(Record.class).mappedTableResource(table).build()));
List<Record> records = drainPublisher(publisher.resultsForTable(table), 3);
assertThat(records.size()).isEqualTo(3);
}
use of software.amazon.awssdk.enhanced.dynamodb.model.BatchGetResultPagePublisher in project aws-sdk-java-v2 by aws.
the class AsyncBatchGetItemTest method notFoundRecordReturnsNull_viaFlattenedItems.
@Test
public void notFoundRecordReturnsNull_viaFlattenedItems() {
insertRecords();
BatchGetItemEnhancedRequest batchGetItemEnhancedRequest = requestWithNotFoundRecord();
BatchGetResultPagePublisher publisher = enhancedAsyncClient.batchGetItem(batchGetItemEnhancedRequest);
List<Record1> resultsForTable1 = drainPublisher(publisher.resultsForTable(mappedTable1), 1);
assertThat(resultsForTable1.size(), is(1));
assertThat(resultsForTable1.get(0).getId(), is(0));
List<Record2> record2List = drainPublisher(publisher.resultsForTable(mappedTable2), 2);
assertThat(record2List.size(), is(2));
assertThat(record2List, containsInAnyOrder(RECORDS_2.toArray()));
}
use of software.amazon.awssdk.enhanced.dynamodb.model.BatchGetResultPagePublisher in project aws-sdk-java-v2 by aws.
the class AsyncBatchGetItemTest method responseWithUnprocessedKeys_iterateItems_shouldFetchUnprocessedKeys.
@Test
public void responseWithUnprocessedKeys_iterateItems_shouldFetchUnprocessedKeys() throws InterruptedException {
stubResponseWithUnprocessedKeys();
BatchGetResultPagePublisher publisher = enhancedClient.batchGetItem(r -> r.readBatches(ReadBatch.builder(Record.class).mappedTableResource(table).build()));
List<Record> records = drainPublisher(publisher.resultsForTable(table), 3);
assertThat(records.size()).isEqualTo(3);
}
Aggregations