Created
July 20, 2013 03:11
-
-
Save debop/6043701 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| @SuppressWarnings("unchecked") | |
| public void configurationTest() throws InterruptedException { | |
| ConfigurationBuilder builder = new ConfigurationBuilder(); | |
| builder.loaders().addStore(MongoDBCacheStoreConfigurationBuilder.class) | |
| .host("localhost") | |
| .port(27017) | |
| .timeout(2000) | |
| .acknowledgment(0) | |
| .database("infinispan_cachestore") | |
| .collection("entries"); | |
| final Configuration config = builder.build(true); | |
| MongoDBCacheStoreConfiguration store = (MongoDBCacheStoreConfiguration) config.loaders().cacheLoaders().get(0); | |
| DefaultCacheManager manager = new DefaultCacheManager(); | |
| manager.defineConfiguration("entries", config); | |
| Cache cache = manager.getCache("entry"); | |
| assertThat(cache).isNotNull(); | |
| for (int i = 0; i < 5000; i++) { | |
| cache.put("Element-" + i, "Value-" + i); | |
| } | |
| Thread.sleep(100); | |
| assertThat(cache.get("Element-0")).isEqualTo("Value-0"); | |
| manager.stop(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment