Created
December 26, 2013 21:12
-
-
Save gscheibel/8138722 to your computer and use it in GitHub Desktop.
MongoDB cachestore standalone test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testCreateCacheStore() throws Exception { | |
ConfigurationBuilder builder = new ConfigurationBuilder(); | |
builder.loaders().addStore(MongoDBCacheStoreConfigurationBuilder.class) | |
.host(hostname) | |
.port(port) | |
.acknowledgment(0) | |
.database(DATABASE) | |
.collection(COLLECTION).async().disable(); | |
Configuration configuration = builder.build(); | |
DefaultCacheManager cacheManager = new DefaultCacheManager(); | |
cacheManager.defineConfiguration("default", configuration); | |
Cache<Object, Object> cache = cacheManager.getCache("default"); | |
cache.put("key", "value"); | |
System.out.println(cache.values()); | |
assertThat(collection.count(), is(1L)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment