Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapLoader can insert null values into IMap #6830

Closed
ahmetmircik opened this issue Nov 23, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@ahmetmircik
Copy link
Member

commented Nov 23, 2015

    public void testNullValuesFromMapLoaderAreInsertedIntoMap() throws Exception {
        Config config = newConfig(new NullLoader());
        HazelcastInstance node = createHazelcastInstance(config);
        IMap map = node.getMap(randomName());

        // load entries.
        map.getAll(new HashSet(asList("key1", "key2", "key3")));

        assertEquals(0, map.size());
    }

    /**
     * Always loads null values for requested keys.
     */
    private static class NullLoader implements MapLoader {

        @Override
        public Object load(Object key) {
            return null;
        }

        @Override
        public Map loadAll(Collection keys) {
            Map map = new HashMap();
            for (Object key : keys) {
                map.put(key, null);
            }
            return map;
        }

        @Override
        public Iterable loadAllKeys() {
            return null;
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.