Skip to content

Commit

Permalink
Modify PessimisticDistSync test to log entries
Browse files Browse the repository at this point in the history
  • Loading branch information
mgencur committed Jul 11, 2012
1 parent e426979 commit c8025e1
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,33 +80,37 @@ protected void createCacheManagers() throws Throwable {

@Test
public void testInvalidPut() throws Exception {
Cache cache = cacheManagers.get(0).getCache("P006");
Cache cache1 = cacheManagers.get(0).getCache("P006");
Cache cache2 = null;

// add 1st 4 elements
for(int i = 0; i < 4; i++){
cache.put(cacheManagers.get(0).getAddress().toString()+"-"+i, "42");
cache1.put(cacheManagers.get(0).getAddress().toString()+"-"+i, "42");
}

// lets check if all elements arrived
CacheStore cs1 = cache.getAdvancedCache().getComponentRegistry().getComponent(CacheLoaderManager.class).getCacheStore();
CacheStore cs1 = cache1.getAdvancedCache().getComponentRegistry().getComponent(CacheLoaderManager.class).getCacheStore();
Set<Object> keys = cs1.loadAllKeys(null);

Assert.assertEquals(keys.size(), 4);

// now start 2nd node
addClusterEnabledCacheManager(getCB());
waitForClusterToForm("P006");

cache = cacheManagers.get(1).getCache("P006");
System.out.println("Size1:" + cache1.size());
cache2 = cacheManagers.get(1).getCache("P006");
System.out.println("Size2:" + cache2.size());

// add next 4 elements
for(int i = 0; i < 4; i++){
cache.put(cacheManagers.get(1).getAddress().toString()+"-"+i, "42");
cache2.put(cacheManagers.get(1).getAddress().toString()+"-"+i, "42");
}
System.out.println("Size1:" + cache1.size());
System.out.println("Size2:" + cache2.size());

Set mergedKeys = new HashSet();
// add keys from all cache stores
CacheStore cs2 = cache.getAdvancedCache().getComponentRegistry().getComponent(CacheLoaderManager.class).getCacheStore();
CacheStore cs2 = cache2.getAdvancedCache().getComponentRegistry().getComponent(CacheLoaderManager.class).getCacheStore();
log.debugf("Load from cache store via cache 1");
mergedKeys.addAll(cs1.loadAllKeys(null));
log.debugf("Load from cache store via cache 2");
Expand Down

0 comments on commit c8025e1

Please sign in to comment.