// node2 has a reference to node 1 as its parent, but node 1 doesn't have
// a corresponding child node entry
bundle2.setParentId(bundle1.getId());
MockPersistenceManager pm = new MockPersistenceManager(Arrays.asList(bundle1, bundle2));
ConsistencyCheckerImpl checker = new ConsistencyCheckerImpl(pm, null, null, master.createUpdateChannel("default"));
// set up cluster event update listener
final TestUpdateEventListener listener = new TestUpdateEventListener();
final UpdateEventChannel slaveEventChannel = slave.createUpdateChannel("default");
slaveEventChannel.setListener(listener);
checker.check(null, false);
Set<ReportItem> reportItems = checker.getReport().getItems();
assertEquals(1, reportItems.size());
ReportItem reportItem = reportItems.iterator().next();
assertEquals(ReportItem.Type.ABANDONED, reportItem.getType());
assertEquals(bundle2.getId().toString(), reportItem.getNodeId());
checker.repair();
// node1 should now have a child node entry for node2
bundle1 = pm.loadBundle(bundle1.getId());
assertEquals(1, bundle1.getChildNodeEntries().size());
assertEquals(bundle2.getId(), bundle1.getChildNodeEntries().get(0).getId());