Package com.amazonaws.services.dynamodb.model

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


//    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()) {
      Assert.assertTrue(item.get("range").getS().compareTo("Range2") < 0);
    }
  }
View Full Code Here


//    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()) {
      Assert.assertTrue(item.get("range").getS().compareTo("Range2") <= 0);
    }
  }
View Full Code Here

//    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()) {
      Assert.assertTrue(item.get("range").getS().compareTo("Range2") > 0);
    }
  }
View Full Code Here

//    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()) {
      Assert.assertTrue(item.get("range").getS().compareTo("Range2") >= 0);
    }
  }
View Full Code Here

    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()) {
      Assert.assertTrue(
                    (item.get("range").getS().compareTo("Range2") == 0)
                    ||
                    (item.get("range").getS().compareTo("Range4") == 0)
                    );
View Full Code Here

    attributeValueList.add(new AttributeValue().withS("Range2"));
    attributeValueList.add(new AttributeValue().withS("Range3"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.BETWEEN);
    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()) {
      Assert.assertTrue(
                    (item.get("range").getS().compareTo("Range2") == 0)
                    ||
                    (item.get("range").getS().compareTo("Range3") == 0)
                    );
View Full Code Here

    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(new AttributeValue().withS("Range"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.BEGINS_WITH);
    request.setRangeKeyCondition(rangeKeyCondition);
    QueryResult result = getClient().query(request);
    Assert.assertNotNull("Null result.", result);
    Assert.assertNotNull("No items returned.", result.getItems());
        Assert.assertEquals("Should return four items.", 4, result.getItems().size());
    for (Map<String, AttributeValue> item : result.getItems()) {
      Assert.assertTrue(
                    item.get("range").getS().startsWith("Range")
                    );
    }
  }
View Full Code Here

    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(new AttributeValue().withS("ange1"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.CONTAINS);
    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()) {
      Assert.assertTrue(
                    item.get("range").getS().contains("ange1")
                    );
    }
  }
View Full Code Here

    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(createNumberAttribute(2));
    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").getN(), "2");
    }
  }
View Full Code Here

    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(createNumberAttribute(2));
    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());
        // NOTE: LT is currently a string comparison, so "11" is < "2".
        Assert.assertEquals("Should return two items.", 2, result.getItems().size());
  }
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.