use of com.baeldung.dynamodb.entity.ProductInfo in project tutorials by eugenp.
the class ProductInfoRepositoryIntegrationTest method givenItemWithExpectedCost_whenRunFindAll_thenItemIsFound.
@Test
public void givenItemWithExpectedCost_whenRunFindAll_thenItemIsFound() {
ProductInfo productInfo = new ProductInfo(EXPECTED_COST, EXPECTED_PRICE);
repository.save(productInfo);
List<ProductInfo> result = (List<ProductInfo>) repository.findAll();
assertThat(result.size(), is(greaterThan(0)));
assertThat(result.get(0).getCost(), is(equalTo(EXPECTED_COST)));
}
use of com.baeldung.dynamodb.entity.ProductInfo in project tutorials by eugenp.
the class ProductInfoRepositoryIntegrationTest method setup.
@Before
public void setup() {
try {
repository = new ProductInfoRepository();
repository.setMapper(dynamoDBMapper);
CreateTableRequest tableRequest = dynamoDBMapper.generateCreateTableRequest(ProductInfo.class);
tableRequest.setProvisionedThroughput(new ProvisionedThroughput(1L, 1L));
amazonDynamoDB.createTable(tableRequest);
} catch (ResourceInUseException e) {
// Do nothing, table already created
}
// TODO How to handle different environments. i.e. AVOID deleting all entries in ProductInfo on table
dynamoDBMapper.batchDelete((List<ProductInfo>) repository.findAll());
}
Aggregations