Package com.amazonaws.services.dynamodbv2.model

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


    attributeValueList.add(new AttributeValue().withS("Range0"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.IN);
    request.getKeyConditions().put("range", 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("Range3"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.BETWEEN);
    request.getKeyConditions().put("range", 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

    attributeValueList.add(new AttributeValue().withS("Range"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.BEGINS_WITH);
    request.getKeyConditions().put("range", 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

    attributeValueList.add(new AttributeValue().withS("ange1"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.CONTAINS);
    request.getKeyConditions().put("range", 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

    attributeValueList.add(createNumberAttribute(2));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.EQ);
    request.getKeyConditions().put("range", 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

    attributeValueList.add(createNumberAttribute(2));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.LT);
    request.getKeyConditions().put("range", 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

    attributeValueList.add(createNumberAttribute(2));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.LE);
    request.getKeyConditions().put("range", rangeKeyCondition);

        QueryResult result = getClient().query(request);

        Assert.assertNotNull("Null result.", result);
    Assert.assertNotNull("No items returned.", result.getItems());
        // NOTE: LE is currently a string comparison, so "11" is <= "2".
        Assert.assertEquals("Should return three items.", 3, result.getItems().size());
  }
View Full Code Here

    attributeValueList.add(createNumberAttribute(2));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.GT);
    request.getKeyConditions().put("range", rangeKeyCondition);

        QueryResult result = getClient().query(request);

        Assert.assertNotNull("Null result.", result);
    Assert.assertNotNull("No items returned.", result.getItems());
        // NOTE: GT is currently a string comparison, so "11" is NOT > "2".
        Assert.assertEquals("Should return three items.", 3, result.getItems().size());
  }
View Full Code Here

    attributeValueList.add(createNumberAttribute(2));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.GE);
    request.getKeyConditions().put("range", rangeKeyCondition);

        QueryResult result = getClient().query(request);

        Assert.assertNotNull("Null result.", result);
    Assert.assertNotNull("No items returned.", result.getItems());
        // NOTE: GE is currently a string comparison, so "11" is NOT > "2".
        Assert.assertEquals("Should return four items.", 4, result.getItems().size());
  }
View Full Code Here

    attributeValueList.add(createNumberAttribute(0));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.IN);
    request.getKeyConditions().put("range", 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").getN().compareTo("2") == 0)
                    ||
                    (item.get("range").getN().compareTo("4") == 0)
                    );
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.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.