-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISPN-5684 Make getAll work with compatibility mode in DIST
* When compatibility mode is enabled, a clustered getAll requests results in a local getAll, whose results should not be unboxed. * Also, when unboxing the result back for the client, unboxing must happen regardless unless the value is null.
- Loading branch information
Showing
2 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
client/hotrod-client/src/test/java/org/infinispan/client/hotrod/GetAllCompatDistTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.infinispan.client.hotrod; | ||
|
||
import org.infinispan.client.hotrod.test.MultiHotRodServersTest; | ||
import org.infinispan.configuration.cache.CacheMode; | ||
import org.infinispan.configuration.cache.ConfigurationBuilder; | ||
import org.testng.annotations.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.testng.AssertJUnit.assertEquals; | ||
|
||
@Test(testName = "client.hotrod.GetAllCompatDistTest", groups = "functional") | ||
public class GetAllCompatDistTest extends MultiHotRodServersTest { | ||
|
||
@Override | ||
protected void createCacheManagers() throws Throwable { | ||
createHotRodServers(2, getCacheConfiguration()); | ||
} | ||
|
||
private ConfigurationBuilder getCacheConfiguration() { | ||
ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); | ||
builder.clustering().hash().numOwners(1).compatibility().enabled(true); | ||
return builder; | ||
} | ||
|
||
public void testGetAllWithCompatibility() { | ||
RemoteCache<String, String> cache = client(0).getCache(); | ||
HashMap<String, String> cachedValues = new HashMap<>(); | ||
for(int i=0; i<100; i++){ | ||
String key = String.format("key-%d", i); | ||
String value = String.format("value-%d", i); | ||
cache.put(key, value); | ||
cachedValues.put(key, value); | ||
} | ||
|
||
Map<String, String> values = cache.getAll(cachedValues.keySet()); | ||
assertEquals(cachedValues.size(), values.size()); | ||
for(String key : values.keySet()){ | ||
assertEquals(cachedValues.get(key), values.get(key)); | ||
} | ||
} | ||
|
||
} | ||
|
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