This Simple JUnit Test Always fail (Hazelcast 3.9.1):
The test class is:
public class TestHZ {
@Test
public void testEviction() {
Config config = new XmlConfigBuilder(getXml()).build();
config.setInstanceName("myTestInstance");
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
IMap<Integer, Integer> cache2 = hz.getMap("MyTest2");
cache2.put(123, 456);
assertNotNull(cache2.get(123)); // <--- ALWAYS OK: conf LRU and 6000 entries
IMap<Integer, Integer> cache = hz.getMap("MyTest");
cache.put(123, 456);
assertNotNull(cache.get(123)); // <--- ALWAYS ERROR: conf LRU and 200 entries
}
private InputStream getXml() {
System.out.println(MY_CONF_XML);
return new ByteArrayInputStream(MY_CONF_XML.getBytes());
}
And a constant for configuration with this value:
private static final String MY_CONF_XML =
"<hazelcast xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n" +
" xsi:schemaLocation=\"http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.9.xsd\"\r\n" +
" xmlns=\"http://www.hazelcast.com/schema/config\">\r\n" +
"\r\n" +
" <map name=\"MyTest\">\r\n" +
" <eviction-policy>LRU</eviction-policy>\r\n" +
" <max-size policy=\"PER_NODE\">200</max-size>\r\n" +
" </map>\r\n" +
"\r\n" +
" <map name=\"MyTest2\">\r\n" +
" <eviction-policy>LRU</eviction-policy>\r\n" +
" <max-size policy=\"PER_NODE\">6000</max-size>\r\n" +
" </map>\r\n" +
"\r\n" +
"</hazelcast>\r\n" +
"";
I always fail to try to leave the first entry when the map configuration contains a maximum size of 200 entries.
Does someone else have this same error?
Why, when configuring with size 6000 it always goes well, and configuring with size 200 always goes wrong?