@Test
public void test_M_M_M_M()
{
FlushManager flushManager = new FlushManager();
PhotographerUni_M_M_M_M a1 = new PhotographerUni_M_M_M_M();
a1.setPhotographerId(1);
PhotographerUni_M_M_M_M a2 = new PhotographerUni_M_M_M_M();
a2.setPhotographerId(2);
AlbumUni_M_M_M_M b1 = new AlbumUni_M_M_M_M();
b1.setAlbumId("b1");
AlbumUni_M_M_M_M b2 = new AlbumUni_M_M_M_M();
b2.setAlbumId("b2");
AlbumUni_M_M_M_M b3 = new AlbumUni_M_M_M_M();
b3.setAlbumId("b3");
PhotoUni_M_M_M_M c1 = new PhotoUni_M_M_M_M();
c1.setPhotoId("c1");
PhotoUni_M_M_M_M c2 = new PhotoUni_M_M_M_M();
c2.setPhotoId("c2");
PhotoUni_M_M_M_M c3 = new PhotoUni_M_M_M_M();
c3.setPhotoId("c3");
PhotoUni_M_M_M_M c4 = new PhotoUni_M_M_M_M();
c4.setPhotoId("c4");
b1.addPhoto(c1);
b1.addPhoto(c2);
b2.addPhoto(c2);
b2.addPhoto(c3);
b3.addPhoto(c3);
b3.addPhoto(c4);
a1.addAlbum(b1);
a1.addAlbum(b2);
ObjectGraph graph1 = graphBuilder.getObjectGraph(a1, null);
pc.getMainCache().addGraphToCache(graph1, pc);
markAllNodeAsDirty();
flushManager.buildFlushStack(graph1.getHeadNode(), EventType.INSERT);
Deque<Node> fs = flushManager.getFlushStack();
Assert.assertEquals(6, fs.size());
flushManager.clearFlushStack();
a2.addAlbum(b2);
a2.addAlbum(b3);
ObjectGraph graph2 = graphBuilder.getObjectGraph(a2, null);
pc.getMainCache().addGraphToCache(graph2, pc);
markAllNodeAsDirty();
flushManager = new FlushManager();