Package com.amazonaws.services.dynamodbv2.model

Examples of com.amazonaws.services.dynamodbv2.model.PutItemRequest


    @Test
    public void putItemWithHashKeyOverwriteItem() {
        createGenericTable(tableName);

        PutItemRequest request = new PutItemRequest().withTableName(tableName).withItem(createGenericItem());
        getClient().putItem(request); // put item beforehand
        PutItemResult res = getClient().putItem(request); // Add another

        Assert.assertNotNull(res);
        Assert.assertNotNull(res.getConsumedCapacity());
View Full Code Here


    @Test
    public void putItemWithHashKeyWithoutItem() {
        createGenericTable(tableName);

        PutItemRequest request = new PutItemRequest().withTableName(tableName);
    try {
      getClient().putItem(request);
      Assert.assertTrue(false);// Should have thrown an exception
    } catch (AmazonServiceException ase) {
    }
View Full Code Here

    @Test
    public void putItemWithHashKeyWithoutTableName() {
        createGenericTable(tableName);

        PutItemRequest request = new PutItemRequest().withItem(createGenericItem());
    try {
      getClient().putItem(request);
      Assert.assertTrue(false);// Should have thrown an exception
    } catch (AmazonServiceException ase) {
    }
View Full Code Here

    //Test: put item with HashKey and RangeKey
    @Test
    public void putItemWithHashKeyAndRangeKey() {
        createGenericHashRangeTable(tableName);

        PutItemRequest request = new PutItemRequest().withTableName(tableName).withItem(createGenericItem());
        PutItemResult res = getClient().putItem(request);

        Assert.assertNotNull(res);
        Assert.assertNotNull(res.getConsumedCapacity());
        Assert.assertEquals(tableName, res.getConsumedCapacity().getTableName());
View Full Code Here

    @Test
    public void putItemWithHashKeyAndRangeKeyOverwriteItem() {
        createGenericHashRangeTable(tableName);

        PutItemRequest request = new PutItemRequest().withTableName(tableName).withItem(createGenericItem());
        getClient().putItem(request); // put item beforehand
        PutItemResult res = getClient().putItem(request); // Add another
        Assert.assertNotNull(res);
        Assert.assertNotNull(res.getConsumedCapacity());
        Assert.assertEquals(tableName, res.getConsumedCapacity().getTableName());
View Full Code Here

    @Test
    public void putItemWithHashKeyAndRangeKeyWithoutItem() {
        createGenericHashRangeTable(tableName);

        PutItemRequest request = new PutItemRequest().withTableName(tableName);
    try {
      getClient().putItem(request);
      Assert.assertTrue(false);// Should have thrown an exception
    } catch (AmazonServiceException ase) {
    }
View Full Code Here

    @Test
    public void putItemWithHashKeyAndRangeKeyWithoutTableName() {
        createGenericHashRangeTable(tableName);

        PutItemRequest request = new PutItemRequest().withItem(createGenericItem());
    try {
      getClient().putItem(request);
      Assert.assertTrue(false);// Should have thrown an exception
    } catch (AmazonServiceException ase) {
    }
View Full Code Here

     @Test
    public void deleteItem() {
        createGenericTable(tableName);

        AttributeValue hash = new AttributeValue("ad"); //createStringAttribute();
        getClient().putItem(new PutItemRequest().withTableName(tableName).withItem(createGenericItem(hash)));
        DeleteItemRequest request = new DeleteItemRequest().withTableName(tableName).withKey(createItemKey("id", hash));
        DeleteItemResult res = getClient().deleteItem(request);

        Assert.assertNotNull(res.getConsumedCapacity());
        Assert.assertEquals(tableName, res.getConsumedCapacity().getTableName());
View Full Code Here

        createTable(tableName, hashAttr, rangeAttr);

        AttributeValue hash = new AttributeValue("ad");
        AttributeValue range1 = new AttributeValue().withN("1");
        AttributeValue range2 = new AttributeValue().withN("2");
        getClient().putItem(new PutItemRequest().withTableName(tableName).withItem(createGenericItem(hash, range1)));
        getClient().putItem(new PutItemRequest().withTableName(tableName).withItem(createGenericItem(hash, range2)));

        DeleteItemRequest request1 = new DeleteItemRequest().withTableName(tableName).withKey(createItemKey("id", hash, "range", range1)).withReturnValues(ReturnValue.ALL_OLD);
        DeleteItemRequest request2 = new DeleteItemRequest().withTableName(tableName).withKey(createItemKey("id", hash, "range", range2)).withReturnValues(ReturnValue.ALL_OLD);
        DeleteItemResult result = getClient().deleteItem(request1);
View Full Code Here

    @Test
    public void deleteItemWithoutTableName() {
        createGenericTable(tableName);

        AttributeValue hash = createStringAttribute();
        getClient().putItem(new PutItemRequest().withTableName(tableName).withItem(createGenericItem(hash)));
        DeleteItemRequest request = new DeleteItemRequest().withKey(createItemKey("id", hash));

    try {
      getClient().deleteItem(request);
      Assert.assertTrue(false);// Should have thrown an exception
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.model.PutItemRequest

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.