@Test
public void testFlashStockForStore()
{
FlushManager flushManager = new FlushManager();
Store store = new Store(1, "Food Bazaar, Noida");
store.addCounter(new BillingCounter(1, "A"));
store.addCounter(new BillingCounter(2, "B"));
store.addCounter(new BillingCounter(3, "C"));
ObjectGraph graph = graphBuilder.getObjectGraph(store, null);
pc.getMainCache().addGraphToCache(graph, pc);
Assert.assertNotNull(pc.getMainCache());
Assert.assertEquals(1, pc.getMainCache().getHeadNodes().size());
PersistenceDelegator pd = new PersistenceDelegator(emfImpl.getKunderaMetadataInstance(), pc);
Node headNode = pc.getMainCache().getNodeFromCache(ObjectGraphUtils.getNodeId("1", Store.class), pd);
Assert.assertNotNull(headNode);
Assert.assertNull(headNode.getParents());
Assert.assertEquals(3, headNode.getChildren().size());
Assert.assertEquals(4, pc.getMainCache().size());
markAllNodeAsDirty();
flushManager.buildFlushStack(headNode, EventType.INSERT);
Deque<Node> fs = flushManager.getFlushStack();
Assert.assertEquals(4, fs.size());
}