Package com.amazonaws.services.dynamodb.model

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


    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(createNumberAttribute(2));
    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());
        // 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


    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(createNumberAttribute(2));
    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());
        // 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

    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(createNumberAttribute(2));
    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());
        // 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(4));
    attributeValueList.add(createNumberAttribute(0));
    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").getN().compareTo("2") == 0)
                    ||
                    (item.get("range").getN().compareTo("4") == 0)
                    );
View Full Code Here

    attributeValueList.add(createNumberAttribute(2));
    attributeValueList.add(createNumberAttribute(3));
    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());
  }
View Full Code Here

    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(createNumberAttribute(1));
    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());
        // NOTE: BEGINS_WITH is currently a string comparison, so "11" begins with "1".
        Assert.assertEquals("Should return two items.", 2, result.getItems().size());
    for (Map<String, AttributeValue> item : result.getItems()) {
      Assert.assertTrue(
                    item.get("range").getN().startsWith("1")
                    );
    }
  }
View Full Code Here

    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(createNumberAttribute(1));
    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());
        // NOTE: CONTAINS is currently a string comparison, so "1", "11", "51" all contain "1".
        Assert.assertEquals("Should return three items.", 3, result.getItems().size());
    for (Map<String, AttributeValue> item : result.getItems()) {
      Assert.assertTrue(
                    item.get("range").getN().contains("1")
                    );
    }
  }
View Full Code Here

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

        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

        List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
        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

    public <T> PaginatedQueryList<T> query(Class<T> clazz, DynamoDBQueryExpression queryExpression, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config);

        QueryResult queryResult = db.query(applyUserAgent(queryRequest));
        return new PaginatedQueryList<T>(this, clazz, db, queryRequest, queryResult);
    }
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.