use of software.amazon.awssdk.services.dynamodb.model.ScanRequest in project syndesis-qe by syndesisio.
the class DynamoDbUtils method verifyRecordIsPresent.
public boolean verifyRecordIsPresent(Map<String, String> recordValue) {
boolean tableContainsItem = false;
ScanRequest scanRequest = ScanRequest.builder().tableName(tableName).build();
ScanResponse result = dynamoDb.scan(scanRequest);
for (Map<String, AttributeValue> item : result.items()) {
if (item.isEmpty()) {
fail("There is no record in the table");
}
int i = item.keySet().size() - 1;
if (!tableContainsItem) {
for (String key : item.keySet()) {
if (item.get(key).s().equals(recordValue.get(key))) {
if (i > 0) {
i--;
} else {
tableContainsItem = true;
break;
}
} else {
break;
}
}
}
}
return tableContainsItem;
}
Aggregations