Package com.hazelcast.query.SampleObjects

Examples of com.hazelcast.query.SampleObjects.Employee


        imap.addIndex("name", false);
        imap.addIndex("city", false);
        imap.addIndex("age", true);
        imap.addIndex("active", false);
        for (int i = 0; i < 5000; i++) {
            Employee employee = new Employee(i, "name" + i % 100, "city" + (i % 100), i % 60, ((i & 1) == 1), (double) i);
            imap.put(String.valueOf(i), employee);
        }
        assertEquals(2, h1.getCluster().getMembers().size());
        assertEquals(2, h2.getCluster().getMembers().size());
        imap = h2.getMap("employees");
View Full Code Here


        IMap imap1 = h1.getMap("employees");
        IMap imap2 = h2.getMap("employees");

        for (int i = 0; i < 5000; i++) {
            boolean test = i % 2 == 0;
            imap1.put(String.valueOf(i), new Employee(test ? null : "name" + i,
                    test ? null : "city" + i, i % 60, true, (double) i));
        }
        long start = Clock.currentTimeMillis();
        Set<Map.Entry> entries = imap2.entrySet(predicate);
        long tookWithout = (Clock.currentTimeMillis() - start);
        assertEquals(2500, entries.size());
        for (Map.Entry entry : entries) {
            Employee c = (Employee) entry.getValue();
            assertNull(c.getName());
            assertNull(c.getCity());
        }
        imap1.destroy();

        imap1 = h1.getMap("employees2");
        imap2 = h2.getMap("employees2");
        imap1.addIndex("name", false);
        imap1.addIndex("city", true);
        imap1.addIndex("age", true);
        imap1.addIndex("active", false);

        for (int i = 0; i < 5000; i++) {
            boolean test = i % 2 == 0;
            imap1.put(String.valueOf(i), new Employee(test ? null : "name" + i,
                    test ? null : "city" + i, i % 60, true, (double) i));
        }
        start = Clock.currentTimeMillis();
        entries = imap2.entrySet(predicate);
        long tookWithIndex = (Clock.currentTimeMillis() - start);
        assertEquals(2500, entries.size());
        for (Map.Entry entry : entries) {
            Employee c = (Employee) entry.getValue();
            assertNull(c.getName());
            assertNull(c.getCity());
        }
        assertTrue("WithIndex: " + tookWithIndex + ", without: " + tookWithout, tookWithIndex < tookWithout);
    }
View Full Code Here

        h2.getLifecycleService().shutdown();
        assertEquals(101, imap.size());
        Set<Map.Entry> entries = imap.entrySet(new SqlPredicate("active and age=23"));
        assertEquals(2, entries.size());
        for (Map.Entry entry : entries) {
            Employee c = (Employee) entry.getValue();
            assertEquals(c.getAge(), 23);
            assertTrue(c.isActive());
        }
    }
View Full Code Here

        imap = h2.getMap("employees");
        assertEquals(101, imap.size());
        Set<Map.Entry> entries = imap.entrySet(new SqlPredicate("active and age=23"));
        assertEquals(2, entries.size());
        for (Map.Entry entry : entries) {
            Employee c = (Employee) entry.getValue();
            assertEquals(c.getAge(), 23);
            assertTrue(c.isActive());
        }
    }
View Full Code Here

        imap = h2.getMap("employees");
        assertEquals(101, imap.size());
        Set<Map.Entry> entries = imap.entrySet(new SqlPredicate("active and age=23"));
        assertEquals(2, entries.size());
        for (Map.Entry entry : entries) {
            Employee c = (Employee) entry.getValue();
            assertEquals(c.getAge(), 23);
            assertTrue(c.isActive());
        }
    }
View Full Code Here

        mapStoreConfig.setImplementation(new MapStoreAdapter() {
            @Override
            public Map loadAll(Collection keys) {
                Map map = new HashMap();
                for (Object key : keys) {
                    Employee emp = new Employee();
                    emp.setActive(true);
                    map.put(key, emp);
                }
                return map;
            }
View Full Code Here

TOP

Related Classes of com.hazelcast.query.SampleObjects.Employee

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.