Package com.amazonaws.services.dynamodb.model

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


    el.setAttributeType(ScalarAttributeType.S);
    return el;
  }

  protected KeySchemaElement createNumberKeyElement() {
    KeySchemaElement el = createStringKeyElement();
    el.setAttributeType(ScalarAttributeType.N);
    return el;
  }
View Full Code Here


    }
    return map;
  }

    protected AttributeValue createItem(String tableName){
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        AttributeValue hash = createStringAttribute();
        Map<String, AttributeValue> item = createGenericItem(hash);
        PutItemRequest req = new PutItemRequest().withTableName(tableName).withItem(item);
        getClient().putItem(req);
View Full Code Here

    @Test
    public void putItemWithHashKey()
    {
        KeySchema schema =
                new KeySchema(
                    new KeySchemaElement().withAttributeName("code").withAttributeType(ScalarAttributeType.S)
                );
        createTable(hashTableName, schema);

        TestClassWithHashKey value = new TestClassWithHashKey();
        value.setCode("hash1");
View Full Code Here

    @Test
    public void putItemWithHashKeyOverwriteItem()
    {
        KeySchema schema =
                new KeySchema(
                    new KeySchemaElement().withAttributeName("code").withAttributeType(ScalarAttributeType.S)
                );
    try {
        createTable(hashTableName, schema);
    } catch (ResourceInUseException riue) {
      // The table is already created, do nothing
View Full Code Here

    @Test
    public void putItemWithHashKeyAndRangeKey()
    {
        KeySchema schema =
                new KeySchema(
                    new KeySchemaElement().withAttributeName("hashCode").withAttributeType(ScalarAttributeType.S)
                );
        schema.setRangeKeyElement(new KeySchemaElement().withAttributeName(
                "rangeCode").withAttributeType(ScalarAttributeType.S));
        createTable(hashRangeTableName, schema);

        TestClassWithHashRangeKey value = new TestClassWithHashRangeKey();
        value.setHashCode("hash1");
View Full Code Here

    @Test
    public void putItemWithHashKeyAndRangeKeyOverwriteItem()
    {
        KeySchema schema =
                new KeySchema(
                    new KeySchemaElement().withAttributeName("hashCode").withAttributeType(ScalarAttributeType.S)
                );
        schema.setRangeKeyElement(new KeySchemaElement().withAttributeName(
                "rangeCode").withAttributeType(ScalarAttributeType.S));
    try {
      createTable(hashRangeTableName, schema);
    } catch (ResourceInUseException riue) {
      // The table is already created
View Full Code Here

    }

    @Test
    public void getUnknownHashItemTest()
    {
    KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("code").withAttributeType(ScalarAttributeType.S));
    createTable(hashTableName, schema);

        String code = "hash1x";
        TestClassWithHashKey value = mapper.load(TestClassWithHashKey.class, code);
        Assert.assertNull("Value should not be found.", value);
View Full Code Here

    }

    @Test
    public void getUnknownHashRangeItemTest()
    {
    KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("hashCode").withAttributeType(ScalarAttributeType.S));
    schema.setRangeKeyElement(new KeySchemaElement().withAttributeName("rangeCode").withAttributeType(ScalarAttributeType.S));
    createTable(hashRangeTableName, schema);

        String hashCode = "hash2x";
        String rangeCode = "range2";
        TestClassWithHashRangeKey value = mapper.load(TestClassWithHashRangeKey.class, hashCode, rangeCode);
View Full Code Here

        Assert.assertNull("Value2 should not be found.", value2);
    }

  @Test
  public void scanIndexForwardFalseTest() {
    KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("hashCode").withAttributeType(ScalarAttributeType.S));
    schema.setRangeKeyElement(new KeySchemaElement().withAttributeName("rangeCode").withAttributeType(ScalarAttributeType.S));
    createTable(hashRangeTableName, schema);

    {
      TestClassWithHashRangeKey c = new TestClassWithHashRangeKey();
      c.setHashCode("code");
View Full Code Here

    Assert.assertEquals("second", res.getStringData());
  }

  @Test
  public void limitTest() {
    KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("hashCode").withAttributeType(ScalarAttributeType.S));
    schema.setRangeKeyElement(new KeySchemaElement().withAttributeName("rangeCode").withAttributeType(ScalarAttributeType.S));
    createTable(hashRangeTableName, schema);

    for (int i = 0; i < 10; i++) {
      TestClassWithHashRangeKey c = new TestClassWithHashRangeKey();
      c.setHashCode("code");
View Full Code Here

TOP

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

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.