コード例 #1
0
  // TODO: test out put item expected and return value
  @Test
  public void getItemTest() {
    AttributeValue hash = createItem(tableName);

    GetItemRequest request = new GetItemRequest().withTableName(tableName);
    request.setKey(createItemKey("id", hash));
    GetItemResult res = getClient().getItem(request);

    Assert.assertNotNull(res.getItem());
    Assert.assertEquals(res.getItem().get("id"), hash);
  }
コード例 #2
0
  @Override
  public TranscodingJob get(final String jobId) {
    final ImmutableMap.Builder<String, AttributeValue> keyBuilder = ImmutableMap.builder();
    keyBuilder.put("transcode-job-id", new AttributeValue(jobId));

    try {
      final GetItemResult result = this.dynamoDB.getItem(TABLE_NAME, keyBuilder.build());
      return new TranscodingJob(
          result.getItem().get("transcode-job-id").getS(),
          Paths.get(result.getItem().get("inputMovie").getS()),
          Paths.get(result.getItem().get("outputMovie").getS()));
    } catch (final AmazonServiceException e) {
      logger.error("AmazonServiceException while getting {}.  RID: {}", jobId, e.getRequestId(), e);
      throw e;
    } catch (final AmazonClientException e) {
      logger.error("AmazonClientException while getting {}.", jobId, e);
      throw e;
    }
  }