use of org.apache.gora.dynamodb.query.DynamoDBQuery in project gora by apache.
the class TestDynamoDBNativeStore method assertTestDeleteByQueryDataStore.
// ==========================================================================
/**
* Tests deleting items using a query
*/
@Override
public void assertTestDeleteByQueryDataStore() {
try {
log.info("test method: TestDeleteByQuery using DynamoDB store.");
DynamoDBKey<Long, String> dKey = new DynamoDBKey<>();
dKey.setHashKey(100L);
dKey.setRangeKey("10/10/1880");
Person p1 = buildPerson(dKey.getHashKey(), dKey.getRangeKey().toString(), "John", "Doe", "Peru", "Brazil", "Ecuador");
dataStore.put(dKey, p1);
dKey.setRangeKey("11/10/1707");
Person p2 = buildPerson(dKey.getHashKey(), dKey.getRangeKey().toString(), "Juan", "Perez", "Germany", "USA", "Scotland");
dataStore.put(dKey, p2);
DynamoDBQuery.setScanCompOp(ComparisonOperator.LE);
DynamoDBQuery.setType(DynamoDBQuery.SCAN_QUERY);
Query<DynamoDBKey, Person> query = new DynamoDBQuery<DynamoDBKey, Person>();
query.setKey(dKey);
log.info("Number of records deleted: " + dataStore.deleteByQuery(query));
} catch (Exception e) {
log.error("Error while running test: TestDeleteByQuery", e.getMessage());
throw new RuntimeException(e);
}
}
Aggregations