Package com.amazonaws.services.dynamodb.model

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


    }

    @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

    Assert.assertEquals(10, mapper.query(TestClassWithHashRangeKey.class, new DynamoDBQueryExpression(new AttributeValue("code")).withLimit(20)).size());
  }

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

    TestClassWithHashKey value = new TestClassWithHashKey();
    value.setCode("éáűőúöüóí");
    value.setStringData("űáéúőóüöí");
View Full Code Here

    }

    @Test
    public void queryWithHashKey() {
        // Setup table with items
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        AttributeValue hashKey = createStringAttribute();
        getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));
        getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey)).withTableName(tableName));
        getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));
View Full Code Here

            Assert.assertEquals(item.get("range").getS(), "Range2");
        }
    }

    private AttributeValue setupTableWithSeveralItems() {
        KeySchema schema = new KeySchema()
                .withHashKeyElement(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S))
                .withRangeKeyElement(new KeySchemaElement().withAttributeName("range").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);

        AttributeValue hashKey1 = createStringAttribute();
View Full Code Here

TOP

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

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.