Skip to content

Commit eabaf90

Browse files
dnltskderXear
authored andcommitted
added rootAttribute configuration for street attribute, according to test cases with Address
1 parent 9fc5dae commit eabaf90

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/test/java/com/dasburo/spring/cache/dynamo/autoconfigure/DynamoCacheAutoConfigurationTest.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
*/
1515
package com.dasburo.spring.cache.dynamo.autoconfigure;
1616

17-
import com.dasburo.spring.cache.dynamo.*;
17+
import com.dasburo.spring.cache.dynamo.DynamoCache;
18+
import com.dasburo.spring.cache.dynamo.DynamoCacheManager;
19+
import com.dasburo.spring.cache.dynamo.TestConfiguration;
20+
import com.dasburo.spring.cache.dynamo.TestDbCreationRule;
21+
import com.dasburo.spring.cache.dynamo.UnitTestBase;
22+
import com.dasburo.spring.cache.dynamo.rootattribute.RootAttributeConfig;
1823
import org.junit.Assert;
1924
import org.junit.Before;
2025
import org.junit.ClassRule;
@@ -24,6 +29,10 @@
2429
import org.springframework.test.context.junit4.SpringRunner;
2530

2631
import java.time.Duration;
32+
import java.util.List;
33+
34+
import static com.amazonaws.services.dynamodbv2.model.ScalarAttributeType.S;
35+
import static java.util.Arrays.asList;
2736

2837
/**
2938
* Unit tests for {@code DynamoCacheAutoConfiguration} class.
@@ -39,6 +48,7 @@ public class DynamoCacheAutoConfigurationTest extends UnitTestBase {
3948
private static final Duration TTL = Duration.ofSeconds(30);
4049
private static final Long READ_CAPACITY_UNITS = 1L;
4150
private static final Long WRITE_CAPACITY_UNITS = 1L;
51+
private static final List<RootAttributeConfig> ROOT_ATTRIBUTES = asList(new RootAttributeConfig("street", S));
4252

4353
@ClassRule
4454
public static TestDbCreationRule dynamoDB = new TestDbCreationRule();
@@ -54,7 +64,9 @@ public void load() {
5464
"spring.cache.dynamo.caches[0].cacheName:" + CACHE_NAME,
5565
"spring.cache.dynamo.caches[0].flushOnBoot:" + FLUSH_ON_BOOT,
5666
"spring.cache.dynamo.caches[0].readCapacityUnits:" + READ_CAPACITY_UNITS,
57-
"spring.cache.dynamo.caches[0].writeCapacityUnits:" + WRITE_CAPACITY_UNITS
67+
"spring.cache.dynamo.caches[0].writeCapacityUnits:" + WRITE_CAPACITY_UNITS,
68+
"spring.cache.dynamo.caches[0].rootAttributes[0].name:" + ROOT_ATTRIBUTES.get(0).getName(),
69+
"spring.cache.dynamo.caches[0].rootAttributes[0].type:" + ROOT_ATTRIBUTES.get(0).getType().name()
5870
);
5971
}
6072

@@ -86,6 +98,8 @@ public void testProperties() {
8698
Assert.assertEquals(TTL, cache.getTtl());
8799
Assert.assertEquals(CACHE_NAME, cache.getName());
88100
Assert.assertEquals(FLUSH_ON_BOOT, cache.isFlushOnBoot());
101+
Assert.assertEquals(ROOT_ATTRIBUTES.get(0).getName(), cache.getRootAttributes().get(0).getName());
102+
Assert.assertEquals(ROOT_ATTRIBUTES.get(0).getType(), cache.getRootAttributes().get(0).getType());
89103
}
90104

91105
}

0 commit comments

Comments
 (0)