コード例 #1
0
 @Test
 public void testDisablingSystemLogs() throws Exception {
   Config config = new Config();
   config.setProperty(GroupProperties.PROP_SYSTEM_LOG_ENABLED, "true");
   config.getGroupConfig().setName("testDisablingSystemLogs");
   HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
   HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(config);
   instance.getMap("map").put("key", "value");
   Node node = TestUtil.getNode(instance);
   assertTrue(node.getSystemLogService().getLogBundle().size() > 0);
   Hazelcast.shutdownAll();
   config.setProperty(GroupProperties.PROP_SYSTEM_LOG_ENABLED, "false");
   instance = Hazelcast.newHazelcastInstance(config);
   instance2 = Hazelcast.newHazelcastInstance(config);
   instance.getMap("map").put("key2", "value2");
   assertTrue(node.getSystemLogService().getLogBundle().size() == 0);
 }
 @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);
   }
 }
コード例 #3
0
ファイル: TestApp.java プロジェクト: karanbatra/hazelcast
 public IMap<Object, Object> getMap() {
   //        if (map == null) {
   map = hazelcast.getMap(namespace);
   //        }
   return map;
 }