Package com.amazonaws.services.dynamodb.model

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


        Assert.assertNotNull(result.getAttributes());
    }

    @Test
    public void deleteItemWithoutTableName() {
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        AttributeValue hash = createStringAttribute();
        getClient().putItem(new PutItemRequest().withTableName(tableName).withItem(createGenericItem(hash)));
        DeleteItemRequest request = new DeleteItemRequest().withKey(new Key(hash));
    try {
View Full Code Here


    }
    }

    @Test
    public void deleteNonExistantItem() {
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        DeleteItemRequest request = new DeleteItemRequest().withTableName(tableName).withKey(new Key(createStringAttribute()));
    try {
      getClient().deleteItem(request);
      Assert.assertTrue(false);// Should have thrown an exception
View Full Code Here

    }
    }

  @Test
  public void putItemWithExpected() {
    KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
    createTable(tableName, schema);

    AttributeValue value = new AttributeValue("test1");
    Map<String, ExpectedAttributeValue> expectedMap = new HashMap<String, ExpectedAttributeValue>();
    expectedMap.put("id", new ExpectedAttributeValue(false));
View Full Code Here

        }
        return map;
    }

    protected AttributeValue putItemInDb() {
        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 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

    //I do not think this is a good design since
    @Test
    public void queryWithHashKeyNotExist() {
        // 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()).withTableName(tableName));
        getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));
View Full Code Here

        Assert.assertSame(result.getItems().size(), 0);
    }

    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();
    AttributeValue hashKey2 = createStringAttribute();
View Full Code Here

        return hashKey1;
    }

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

    AttributeValue hashKey1 = createStringAttribute();
    AttributeValue hashKey2 = createStringAttribute();
View Full Code Here

    private int nbOfItems;

    @Before
    public void setUp() {
        tableName = createTableName();
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        nbOfItems = 90;
        for (int i = 0; i < (nbOfItems); i++) {
            putItemInDb(createIntegerAttribute(i/10+1,i/10+1));     //1~9
            putItemInDb(createIntegerAttribute(i/10+11,i/10+11));   //11~19
View Full Code Here

            return inProcessMapper;
        }
    }

  protected KeySchemaElement createStringKeyElement() {
    KeySchemaElement el = new KeySchemaElement();
    el.setAttributeName(UUID.randomUUID().toString().substring(0, 2));
    el.setAttributeType(ScalarAttributeType.S);
    return el;
  }
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.