コード例 #1
0
  // Test: put item with HashKey
  @Test
  public void putItemWithHashKey() {
    createGenericTable(tableName);

    PutItemRequest request =
        new PutItemRequest().withTableName(tableName).withItem(createGenericItem());
    PutItemResult res = getClient().putItem(request);

    Assert.assertNotNull(res);
    Assert.assertNotNull(res.getConsumedCapacity());
    Assert.assertEquals(tableName, res.getConsumedCapacity().getTableName());
    Assert.assertNotNull(res.getConsumedCapacity().getCapacityUnits());
  }
コード例 #2
0
  @Test
  public void putItemWithHashKeyAndRangeKeyOverwriteItem() {
    createGenericHashRangeTable(tableName);

    PutItemRequest request =
        new PutItemRequest().withTableName(tableName).withItem(createGenericItem());
    getClient().putItem(request); // put item beforehand
    PutItemResult res = getClient().putItem(request); // Add another
    Assert.assertNotNull(res);
    Assert.assertNotNull(res.getConsumedCapacity());
    Assert.assertEquals(tableName, res.getConsumedCapacity().getTableName());
    Assert.assertNotNull(res.getConsumedCapacity().getCapacityUnits());
  }