assertEquals(100L,staticTableObject.get("foreignid"));
assertEquals(101,staticTableObject.get("type"));
assertEquals(103,staticTableObject.get("filtered"));
assertEquals("This is data 1",staticTableObject.get("data1"));
Criteria criteria = new Criteria();
SortedMap<String,Object> values = Maps.newTreeMap();
values.put("foreignid", Long.valueOf(200L));
criteria.setIndexKeys(values);
criteria.setLimit(0L);
List<Map<String, Object>> indexObjects = om.list("testtype", criteria);
assertEquals(1, indexObjects.size());
assertEquals(staticTableObject.get("data1"),indexObjects.get(0).get("data1"));
assertEquals(200L,indexObjects.get(0).get("foreignid"));
assertEquals(201,indexObjects.get(0).get("type"));
assertEquals(203,indexObjects.get(0).get("filtered"));
//wait for consistency
Thread.sleep(3000);
//now run the processor
UpdateProcessor up = new UpdateProcessor(om);
up.process(9999L);
//verify that the object is no longer present in the invalid indexes
//Should be missing from the bad index
criteria = new Criteria();
values = Maps.newTreeMap();
values.put("foreignid", Long.valueOf(200));
criteria.setIndexKeys(values);
criteria.setLimit(0L);
indexObjects = om.list("testtype", criteria);
assertEquals(0, indexObjects.size());
//But is should be present in the correct index
criteria = new Criteria();
values = Maps.newTreeMap();
values.put("foreignid", Long.valueOf(100));
criteria.setIndexKeys(values);
indexObjects = om.list("testtype", criteria);
assertEquals(1, indexObjects.size());
assertEquals(staticTableObject.get("data1"),indexObjects.get(0).get("data1"));
assertEquals(100L,indexObjects.get(0).get("foreignid"));
assertEquals(101,indexObjects.get(0).get("type"));