Package com.amazonaws.services.dynamodb.model

Examples of com.amazonaws.services.dynamodb.model.TableDescription


      JSONWriter jsonWriter = new JSONWriter(stringWriter);
      jsonWriter.object();

      if (createTableResult.getTableDescription() != null) {
        jsonWriter.key("TableDescription").object();
        TableDescription desc = createTableResult.getTableDescription();
        if (desc.getCreationDateTime() != null) {
          jsonWriter.key("CreationDateTime").value(desc.getCreationDateTime());
        }
        if (desc.getTableName() != null) {
          jsonWriter.key("TableName").value(desc.getTableName());
        }
        if (desc.getTableStatus() != null) {
          jsonWriter.key("TableStatus").value(desc.getTableStatus());
        }

        KeySchema keySchema = desc.getKeySchema();
        if (keySchema != null) {
          jsonWriter.key("KeySchema").object();
          KeySchemaElement hashKeyElement = keySchema.getHashKeyElement();
          if (hashKeyElement != null) {
            jsonWriter.key("HashKeyElement").object();
            if (hashKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(hashKeyElement.getAttributeName());
            }
            if (hashKeyElement.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(hashKeyElement.getAttributeType());
            }
            jsonWriter.endObject();
          }
          KeySchemaElement rangeKeyElement = keySchema.getRangeKeyElement();
          if (rangeKeyElement != null) {
            jsonWriter.key("RangeKeyElement").object();
            if (rangeKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(rangeKeyElement.getAttributeName());
            }
            if (rangeKeyElement.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(rangeKeyElement.getAttributeType());
            }
            jsonWriter.endObject();
          }
          jsonWriter.endObject();
        }
        ProvisionedThroughputDescription provisionedThroughput = desc.getProvisionedThroughput();
        if (provisionedThroughput != null) {
          jsonWriter.key("ProvisionedThroughput").object();
          if (provisionedThroughput.getReadCapacityUnits() != null) {
            jsonWriter.key("ReadCapacityUnits").value(provisionedThroughput.getReadCapacityUnits());
          }
View Full Code Here


  }

  @Test
  public void createTableWithStringHashKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createKeySchema(createStringKeyElement()));
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here

  }

  @Test
  public void createTableWithNumberHashKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createKeySchema(createNumberKeyElement()));
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here

  }

  @Test
  public void createTableWithStringHashKeyAndStringRangeKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createKeySchema(createStringKeyElement(), createStringKeyElement()));
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here


  @Test
  public void createTableWithStringHashKeyAndNumberRangeKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createKeySchema(createStringKeyElement(), createNumberKeyElement()));
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here

  }

  @Test
  public void createTableWithNumberHashKeyAndStringRangeKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createKeySchema(createNumberKeyElement(), createStringKeyElement()));
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here

  }

  @Test
  public void createTableWithNumberHashKeyAndNumberRangeKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createKeySchema(createNumberKeyElement(), createNumberKeyElement()));
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here

    String name = createTableName();
    createTable(name);
    ProvisionedThroughput throughput = new ProvisionedThroughput().withReadCapacityUnits(50L).withWriteCapacityUnits(50L);
    UpdateTableRequest req = new UpdateTableRequest().withTableName(name).withProvisionedThroughput(throughput);
    Date date = new Date();
    TableDescription desc = getClient().updateTable(req).getTableDescription();
    Assert.assertNotNull(desc);
    Assert.assertEquals(name, desc.getTableName());
    Assert.assertEquals(Math.round(date.getTime() / 1000), Math.round(desc.getProvisionedThroughput().getLastDecreaseDateTime().getTime() / 1000));
    Assert.assertEquals(Math.round(date.getTime() / 1000), Math.round(desc.getProvisionedThroughput().getLastIncreaseDateTime().getTime() / 1000));
  }
View Full Code Here

    private String hashKeyValue2;

    @Before
    public void setUp() throws Exception {
        tableName1 = createTableName();
        TableDescription tableDescription1 = createTable(tableName1);
        hashKeyValue1 = tableDescription1.getKeySchema().getHashKeyElement().getAttributeName();

        tableName2 = createTableName();
        TableDescription tableDescription2 = createTable(tableName2);
        hashKeyValue2 = tableDescription2.getKeySchema().getHashKeyElement().getAttributeName();
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodb.model.TableDescription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.