Package com.amazonaws.services.dynamodb.model

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


        inProcessClient.save(PERSISTENCE_PATH);
        createNewInProcessClient().restore(PERSISTENCE_PATH);

        AttributeValue hashKey = new AttributeValue().withS("1");
        QueryRequest request = new QueryRequest(tableName, hashKey);
        QueryResult result = getClient().query(request);
        Assert.assertNotNull(result.getItems());
        Assert.assertNotSame(result.getItems().size(), 0);
        Map<String, AttributeValue> row = result.getItems().get(0);
        assertEquals(row.get("id"), hashKey);
        Assert.assertArrayEquals(row.get("count").getNS().toArray(), new String[]{"100", "102"});
    }
View Full Code Here


        inProcessClient.save(PERSISTENCE_PATH);
        createNewInProcessClient().restore(PERSISTENCE_PATH);

        AttributeValue hashKey = new AttributeValue().withS("1");
        QueryRequest request = new QueryRequest(tableName, hashKey);
        QueryResult result = getClient().query(request);
        Assert.assertNotNull(result.getItems());
        Assert.assertNotSame(result.getItems().size(), 0);
        Map<String, AttributeValue> row = result.getItems().get(0);
        assertEquals(row.get("id"), hashKey);
        assertEquals(row.get("count").getN(), "102");
    }
View Full Code Here

        inProcessClient.save(PERSISTENCE_PATH);
        createNewInProcessClient().restore(PERSISTENCE_PATH);

        AttributeValue hashKey = new AttributeValue().withS("1");
        QueryRequest request = new QueryRequest(tableName, hashKey);
        QueryResult result = getClient().query(request);
        Assert.assertNotNull(result.getItems());
        Assert.assertNotSame(result.getItems().size(), 0);
        Map<String, AttributeValue> row = result.getItems().get(0);
        assertEquals(row.get("id"), hashKey);
        assertEquals(row.get("count").getN(), "102");
        assertEquals(row.get("ids").getS(), "[er, er]");
    }
View Full Code Here

        inProcessClient.save(PERSISTENCE_PATH);
        createNewInProcessClient().restore(PERSISTENCE_PATH);

        AttributeValue hashKey = new AttributeValue().withS("1");
        QueryRequest request = new QueryRequest(tableName, hashKey);
        QueryResult result = getClient().query(request);
        Assert.assertNotNull(result.getItems());
        Assert.assertNotSame(result.getItems().size(), 0);
        Map<String, AttributeValue> row = result.getItems().get(0);
        assertEquals(row.get("id"), hashKey);
        assertEquals(row.get("count").getN(), "102");
        assertEquals(row.get("ids").getS(), "[er, er]");
    }
View Full Code Here

        inProcessClient.save(PERSISTENCE_PATH);
        createNewInProcessClient().restore(PERSISTENCE_PATH);

        AttributeValue hashKey = new AttributeValue().withS("1");
        QueryRequest request = new QueryRequest(tableName, hashKey);
        QueryResult result = getClient().query(request);
        Assert.assertNotNull(result.getItems());
        Assert.assertNotSame(result.getItems().size(), 0);
        Map<String, AttributeValue> row = result.getItems().get(0);
        assertEquals(row.get("id"), hashKey);
        assertEquals(row.get("count").getN(), "102");
        Assert.assertNull(row.get("ids"));
    }
View Full Code Here

        inProcessClient.save(PERSISTENCE_PATH);
        createNewInProcessClient().restore(PERSISTENCE_PATH);

        AttributeValue hashKey = new AttributeValue().withS("1");
        QueryRequest request = new QueryRequest(tableName, hashKey);
        QueryResult result = getClient().query(request);

        assertNotNull(result.getItems());
        assertTrue(!result.getItems().isEmpty());

        Map<String, AttributeValue> row = result.getItems().get(0);

        assertEquals(hashKey, row.get("id"));
        assertEquals("2", row.get("value").getN());
    }
View Full Code Here

    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey)).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));

    QueryRequest request = new QueryRequest(tableName, hashKey);
    QueryResult result = getClient().query(request);
    Assert.assertNotNull(result.getItems());
    Assert.assertNotSame(result.getItems().size(), 0);
    Assert.assertEquals(result.getItems().get(0).get("id"), hashKey);
  }
View Full Code Here

        getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));
        getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));

        QueryRequest request = new QueryRequest(tableName, hashKey);
        Assert.assertNotNull(request);
        QueryResult result = getClient().query(request);
        Assert.assertNotNull(result.getItems());     //result should be null but unfortunately it not.
        Assert.assertSame(result.getItems().size(), 0);
    }
View Full Code Here

    List<String> attrToGet = new ArrayList<String>();
    attrToGet.add("range");
    attrToGet.add("attr1");
    attrToGet.add("bogusAttr");
    request.setAttributesToGet(attrToGet);
    QueryResult result = getClient().query(request);
    Assert.assertNotNull(result);
    Assert.assertNotNull(result.getItems());
    Assert.assertNotNull(result.getItems().get(0));
    Assert.assertFalse("First item should not contain 'id'.", result.getItems().get(0).containsKey("id"));
    Assert.assertTrue("First item missing 'range'.", result.getItems().get(0).containsKey("range"));
    Assert.assertTrue("First item missing 'attr1'.", result.getItems().get(0).containsKey("attr1"));
    Assert.assertFalse("First item should not contain 'bogusAttr'.", result.getItems().get(0).containsKey("bogusAttr"));
  }
View Full Code Here

//    attributeValueList.add(new AttributeValue().withN("1"));
    attributeValueList.add(createStringAttribute("Range2"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.EQ);
    request.setRangeKeyCondition(rangeKeyCondition);
    QueryResult result = getClient().query(request);
    Assert.assertNotNull("Null result.", result);
    Assert.assertNotNull("No items returned.", result.getItems());
        Assert.assertEquals("Should return one item.", 1, result.getItems().size());
    for (Map<String, AttributeValue> item : result.getItems()) {
      Assert.assertEquals(item.get("range").getS(), "Range2");
    }
  }
View Full Code Here

TOP

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

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.