Package com.amazonaws.services.dynamodb.model

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


        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);
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);
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);
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());
View Full Code Here

  @Test
  public void queryWithHashKeyAndRangeKeyConditionEQTest() {
        AttributeValue hashKey = setupTableWithSeveralItems();

        QueryRequest request = new QueryRequest().withTableName(tableName).withHashKeyValue(hashKey);

    Condition rangeKeyCondition = new Condition();
    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
//    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()) {
View Full Code Here

  @Test
  public void queryWithHashKeyAndRangeKeyConditionLTTest() {
        AttributeValue hashKey = setupTableWithSeveralItems();

        QueryRequest request = new QueryRequest().withTableName(tableName).withHashKeyValue(hashKey);

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

  @Test
  public void queryWithHashKeyAndRangeKeyConditionLETest() {
        AttributeValue hashKey = setupTableWithSeveralItems();

        QueryRequest request = new QueryRequest().withTableName(tableName).withHashKeyValue(hashKey);

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

  @Test
  public void queryWithHashKeyAndRangeKeyConditionGTTest() {
        AttributeValue hashKey = setupTableWithSeveralItems();

        QueryRequest request = new QueryRequest().withTableName(tableName).withHashKeyValue(hashKey);

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

  @Test
  public void queryWithHashKeyAndRangeKeyConditionGETest() {
        AttributeValue hashKey = setupTableWithSeveralItems();

        QueryRequest request = new QueryRequest().withTableName(tableName).withHashKeyValue(hashKey);

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

  @Test
  public void queryWithHashKeyAndRangeKeyConditionINTest() {
        AttributeValue hashKey = setupTableWithSeveralItems();

        QueryRequest request = new QueryRequest().withTableName(tableName).withHashKeyValue(hashKey);

    Condition rangeKeyCondition = new Condition();
    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(new AttributeValue().withS("Range2"));
    attributeValueList.add(new AttributeValue().withS("Range4"));
    attributeValueList.add(new AttributeValue().withS("Range0"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.IN);
    request.setRangeKeyCondition(rangeKeyCondition);
    QueryResult result = getClient().query(request);
    Assert.assertNotNull("Null result.", result);
    Assert.assertNotNull("No items returned.", result.getItems());
        Assert.assertEquals("Should return two items.", 2, result.getItems().size());
    for (Map<String, AttributeValue> item : result.getItems()) {
View Full Code Here

TOP

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

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.