コード例 #1
0
  @Test
  public void createsGlobalIndices() {
    List<TableDescription> tables = DynamoTestUtils.MAPPER.getTables(TestTask.class);
    TableDescription table = DynamoTestUtils.getTableByName(tables, "TestTask");
    assertEquals(3, table.getGlobalSecondaryIndexes().size());

    GlobalSecondaryIndexDescription index =
        findIndex(table.getGlobalSecondaryIndexes(), "guid-index");
    assertEquals("INCLUDE", index.getProjection().getProjectionType());
    assertEquals("guid", index.getKeySchema().get(0).getAttributeName());
    assertEquals(Long.valueOf(18), index.getProvisionedThroughput().getWriteCapacityUnits());
    assertEquals(Long.valueOf(20), index.getProvisionedThroughput().getReadCapacityUnits());

    index = findIndex(table.getGlobalSecondaryIndexes(), "healthCode-scheduledOn-index");
    assertEquals("ALL", index.getProjection().getProjectionType());
    assertEquals("healthCode", index.getKeySchema().get(0).getAttributeName());
    assertEquals("scheduledOn", index.getKeySchema().get(1).getAttributeName());
    assertEquals(Long.valueOf(18), index.getProvisionedThroughput().getWriteCapacityUnits());
    assertEquals(Long.valueOf(20), index.getProvisionedThroughput().getReadCapacityUnits());

    index = findIndex(table.getGlobalSecondaryIndexes(), "healthCode-expiresOn-index");
    assertEquals("expiresOn", index.getKeySchema().get(0).getAttributeName());
  }
コード例 #2
0
 @Test
 public void testGetAnnotatedTables() {
   List<TableDescription> tables = DynamoTestUtils.MAPPER.getTables(DynamoTestUtils.PACKAGE);
   assertNotNull(tables);
   assertEquals(2, tables.size());
   Map<String, TableDescription> tableMap = new HashMap<String, TableDescription>();
   for (TableDescription table : tables) {
     tableMap.put(table.getTableName(), table);
   }
   String tableName =
       Environment.LOCAL.name().toLowerCase()
           + "-"
           + DynamoTestUtils.class.getSimpleName()
           + "-TestHealthDataRecord";
   TableDescription table = tableMap.get(tableName);
   assertNotNull(table);
   assertEquals(2, table.getKeySchema().size());
   assertEquals(5, table.getAttributeDefinitions().size());
   assertEquals(2, table.getLocalSecondaryIndexes().size());
   assertEquals(1, table.getGlobalSecondaryIndexes().size());
   assertEquals(30L, table.getProvisionedThroughput().getReadCapacityUnits().longValue());
   assertEquals(50L, table.getProvisionedThroughput().getWriteCapacityUnits().longValue());
 }