public void doFunctionalQueryTest(IMap imap) {
   Employee em = new Employee("joe", 33, false, 14.56);
   imap.put("1", new Employee("joe", 33, false, 14.56));
   imap.put("2", new Employee("ali", 23, true, 15.00));
   for (int i = 3; i < 103; i++) {
     imap.put(
         String.valueOf(i), new Employee("name" + i, i % 60, ((i % 2) == 1), Double.valueOf(i)));
   }
   Set<Map.Entry> entries = imap.entrySet();
   assertEquals(102, entries.size());
   int itCount = 0;
   for (Map.Entry entry : entries) {
     Employee c = (Employee) entry.getValue();
     itCount++;
   }
   assertEquals(102, itCount);
   EntryObject e = new PredicateBuilder().getEntryObject();
   Predicate predicate = e.is("active").and(e.get("age").equal(23));
   entries = imap.entrySet(predicate);
   assertEquals(3, entries.size());
   for (Map.Entry entry : entries) {
     Employee c = (Employee) entry.getValue();
     assertEquals(c.getAge(), 23);
     assertTrue(c.isActive());
   }
   imap.remove("2");
   entries = imap.entrySet(predicate);
   assertEquals(2, entries.size());
   for (Map.Entry entry : entries) {
     Employee c = (Employee) entry.getValue();
     assertEquals(c.getAge(), 23);
     assertTrue(c.isActive());
   }
 }
 @Test
 public void addIndex() {
   HazelcastClient hClient = getHazelcastClient();
   IMap map = hClient.getMap("addIndex");
   int size = 1000;
   for (int i = 0; i < size; i++) {
     map.put(String.valueOf(i), new Employee("name" + i, i, true, 0));
   }
   EntryObject e = new PredicateBuilder().getEntryObject();
   Predicate predicate = e.get("age").equal(23);
   long begin = Clock.currentTimeMillis();
   Set<Entry<Object, Object>> set = map.entrySet(predicate);
   long timeWithoutIndex = Clock.currentTimeMillis() - begin;
   assertEquals(1, set.size());
   assertEquals(size, map.size());
   map.destroy();
   map = hClient.getMap("addIndex");
   map.addIndex("age", true);
   for (int i = 0; i < size; i++) {
     map.put(String.valueOf(i), new Employee("name" + i, i, true, 0));
   }
   begin = Clock.currentTimeMillis();
   set = map.entrySet(predicate);
   long timeWithIndex = Clock.currentTimeMillis() - begin;
   assertEquals(1, set.size());
   assertEquals(size, map.size());
   assertTrue(timeWithoutIndex > 2 * timeWithIndex);
   //    	map.addIndex("age", true);
 }
 @Test
 public void iterateOverMapEntries() {
   HazelcastClient hClient = getHazelcastClient();
   IMap<String, String> map = hClient.getMap("iterateOverMapEntries");
   map.put("1", "A");
   map.put("2", "B");
   map.put("3", "C");
   Set<Entry<String, String>> entrySet = map.entrySet();
   assertEquals(3, entrySet.size());
   Set<String> keySet = map.keySet();
   for (Entry<String, String> entry : entrySet) {
     assertTrue(keySet.contains(entry.getKey()));
     assertEquals(entry.getValue(), map.get(entry.getKey()));
   }
   Iterator<Entry<String, String>> it = entrySet.iterator();
   for (String key : keySet) {
     MapEntry mapEntry = map.getMapEntry(key);
     assertEquals(1, mapEntry.getHits());
   }
   while (it.hasNext()) {
     it.next();
     it.remove();
   }
   assertTrue(map.isEmpty());
 }
 @Test
 public void testSqlPredicate() {
   HazelcastInstance h = getHazelcastInstance();
   HazelcastClient hClient = getHazelcastClient();
   IMap<Integer, Employee> map = hClient.getMap("testSqlPredicate");
   for (int i = 0; i < 100; i++) {
     h.getMap("testSqlPredicate").put(i, new Employee("" + i, i, i % 2 == 0, i));
   }
   Set<Entry<Integer, Employee>> set = map.entrySet(new SqlPredicate("active AND age < 30"));
   for (Entry<Integer, Employee> entry : set) {
     System.out.println(entry.getValue());
     assertTrue(entry.getValue().age < 30);
     assertTrue(entry.getValue().active);
   }
 }