Package com.amazonaws.services.dynamodbv2.document

Examples of com.amazonaws.services.dynamodbv2.document.Table.scan()


    @Test
    public void testPropertyChange() throws Exception {
        AmazonDynamoDB mockBasicDbClient = mock(AmazonDynamoDB.class);

        //3 of the first config to cover: object creation, threadRun at 0 delay, load properties
        when(mockBasicDbClient.scan(any(ScanRequest.class))).thenReturn(DynamoDbMocks.basicScanResult1,
                DynamoDbMocks.basicScanResult1, DynamoDbMocks.basicScanResult1, DynamoDbMocks.basicScanResult2);
        DynamoDbConfigurationSource source = new DynamoDbConfigurationSource(mockBasicDbClient);

        FixedDelayPollingScheduler scheduler = new FixedDelayPollingScheduler(0, 500, false);
        DynamicConfiguration dynamicConfig = new DynamicConfiguration(source, scheduler);
View Full Code Here


    @Test
    public void testPoll() throws Exception {
        AmazonDynamoDB mockContextDbClient = mock(AmazonDynamoDB.class);

        when(mockContextDbClient.scan(any(ScanRequest.class))).thenReturn(DynamoDbMocks.contextScanResult1,
                DynamoDbMocks.contextScanResult2);
        DynamoDbDeploymentContextTableCache cache = new DynamoDbDeploymentContextTableCache(mockContextDbClient, 100, 100);

        Collection<PropertyWithDeploymentContext> props = cache.getProperties();
        assertEquals(4, props.size());
View Full Code Here

public class DynamoDbConfigurationSourceTest {

    @Test
    public void testPoll() throws Exception {
        AmazonDynamoDB mockBasicDbClient = mock(AmazonDynamoDB.class);
        when(mockBasicDbClient.scan(any(ScanRequest.class))).thenReturn(DynamoDbMocks.basicScanResult1);

        DynamoDbConfigurationSource testConfigSource = new DynamoDbConfigurationSource(mockBasicDbClient);
        PollResult result = testConfigSource.poll(false, null);
        assertEquals(3, result.getComplete().size());
        assertEquals("bar", result.getComplete().get("foo"));
View Full Code Here

    }

    @Test
    public void testUpdate() throws Exception {
        AmazonDynamoDB mockBasicDbClient = mock(AmazonDynamoDB.class);
        when(mockBasicDbClient.scan(any(ScanRequest.class))).thenReturn(DynamoDbMocks.basicScanResult1, DynamoDbMocks.basicScanResult2);

        DynamoDbConfigurationSource testConfigSource = new DynamoDbConfigurationSource(mockBasicDbClient);

        PollResult result = testConfigSource.poll(false, null);
        assertEquals(3, result.getComplete().size());
View Full Code Here

    @Cacheable(lifetime = DefaultDynamo.LIFETIME, unit = TimeUnit.MINUTES)
    public ConcurrentMap<URN, Domains> load() {
        final ConcurrentMap<URN, Domains> domains =
            new ConcurrentHashMap<URN, Domains>(0);
        final AmazonDynamoDB amazon = this.client.get();
        final ScanResult result = amazon.scan(new ScanRequest(this.table));
        for (final Map<String, AttributeValue> item : result.getItems()) {
            final String syslog;
            if (item.containsKey(DefaultDynamo.SYSLOG)) {
                syslog = item.get(DefaultDynamo.SYSLOG).getS();
            } else {
View Full Code Here

    }

    @Test
    public void howToUseScanFilters() {
        Table table = dynamo.getTable(TABLE_NAME);
        ItemCollection<?> col = table.scan(
                new ScanFilter(HASH_KEY_NAME).eq("foo"),
                new ScanFilter(RANGE_KEY_NAME).between(1, 10)
        );
        int count = 0;
        for (Item item: col) {
View Full Code Here

    }

    @Test
    public void howToUseFilterExpression() {
        Table table = dynamo.getTable(TABLE_NAME);
        ItemCollection<?> col = table.scan(
            // filter expression
              "myHashKey = :myHashKey AND "
            + "myRangeKey BETWEEN :lo and :hi AND "
            + "intAttr > :intAttr",
            // no attribute name substitution
View Full Code Here

    }

    @Test
    public void howToUseFilterExpression_AttrNameSubstitution() {
        Table table = dynamo.getTable(TABLE_NAME);
        ItemCollection<?> col = table.scan(
            // filter expression
              "myHashKey = :myHashKey AND "
            + "#myRangeKey BETWEEN :lo and :hi AND "
            + "intAttr > :intAttr",
            // attribute name substitution
View Full Code Here

    }

    @Test
    public void howToUseProjectionExpression() {
        Table table = dynamo.getTable(TABLE_NAME);
        ItemCollection<?> col = table.scan(
            // filter expression
              "myHashKey = :myHashKey AND "
            + "#myRangeKey BETWEEN :lo and :hi AND "
            + "intAttr > :intAttr",
            // projection expression
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.