public void testCancel2() { Cloud cloud = getCloud(); { Transaction t = cloud.getTransaction("cancel2"); Node node = t.getNode(newNode); node.setStringValue("title", "xxxxx"); node.commit(); t.cancel(); } { Transaction t = cloud.getTransaction("cancel2"); Node node = t.getNode(newNode); assertEquals("foo", node.getStringValue("title")); t.cancel(); } }
// MMB-1893 public void testDeleteNodeWitRelationsAndCancel() { Cloud cloud = getCloud(); int urlCount0 = Queries.count(cloud.getNodeManager("urls").createQuery()); int relCount0 = Queries.count(cloud.getNodeManager("insrel").createQuery()); Node url = cloud.getNodeManager("urls").createNode(); url.commit(); Node news = cloud.getNode(newNode); RelationManager rm = cloud.getRelationManager("urls", "news", "posrel"); Relation r = url.createRelation(news, rm); r.commit(); int urlCount = Queries.count(cloud.getNodeManager("urls").createQuery()); int relCount = Queries.count(cloud.getNodeManager("insrel").createQuery()); assertEquals(urlCount0 + 1, urlCount); assertEquals(relCount0 + 1, relCount); Transaction t = cloud.getTransaction("deletewithrelationsandcancel"); Node turl = t.getNode(url.getNumber()); turl.delete(true); t.cancel(); int urlCountAfter = Queries.count(cloud.getNodeManager("urls").createQuery()); assertEquals(urlCount, urlCountAfter); int relCountAfter = Queries.count(cloud.getNodeManager("insrel").createQuery()); assertEquals(relCount, relCountAfter); // MMB-1893 }
public void testCancelDelete() { Cloud cloud = getCloud(); Transaction t = cloud.getTransaction("bar5"); Node node = t.getNode(newNode); node.delete(); t.cancel(); assertTrue(cloud.hasNode(newNode)); }
public void testMMB1546() { Cloud cloud = getCloud(); Transaction t = cloud.getTransaction("test0"); Node nt = t.getNode(newNode); nt.setValue("title", "bla"); // t.cancel(); _DONT_ cancel Node nc = cloud.getNode(newNode); nc.setValue("title", "bloe"); nc.commit(); assertEquals("bloe", nc.getStringValue("title")); assertEquals("bloe", cloud.getNode(newNode).getStringValue("title")); t.cancel(); assertEquals("bloe", cloud.getNode(newNode).getStringValue("title")); }
public void testGetTransaction() { Cloud cloud = getCloud(); { Transaction t = cloud.getTransaction("gettransactiontest"); Node node = t.getNode(newNode); node.setStringValue("title", "xxxxx"); } { Transaction t = cloud.getTransaction("gettransactiontest"); Node node = t.getNode(newNode); assertEquals("xxxxx", node.getStringValue("title")); t.cancel(); } }
public void testReuseTransaction() { Cloud cloud = getCloud(); { Node node = cloud.getNode(newNode); node.setStringValue("title", "zzyyxx"); node.commit(); assertEquals("zzyyxx", cloud.getNode(newNode).getStringValue("title")); } { Transaction t = cloud.getTransaction("bar4"); assertEquals(0, t.getNodes().size()); Node node = t.getNode(newNode); assertEquals("zzyyxx", node.getStringValue("title")); assertEquals(1, t.getNodes().size()); node.setStringValue("title", "wwwwww"); node.commit(); assertEquals("wwwwww", node.getStringValue("title")); t.cancel(); assertEquals("zzyyxx", cloud.getNode(newNode).getStringValue("title")); } assertEquals("zzyyxx", cloud.getNode(newNode).getStringValue("title")); }
// MMB-1857 public void testGetNodes() { Cloud cloud = getCloud(); Transaction t = cloud.getTransaction("testgetnodes"); Node n = t.getNode(newNode); Node url = t.getNodeManager("urls").createNode(); RelationManager rm = t.getRelationManager("urls", "news", "posrel"); Relation r = url.createRelation(n, rm); { // should not give NPE's or so n.commit(); url.commit(); r.commit(); } assertEquals(3, t.getNodes().size()); // 2 nodes and one relation for (Node rn : t.getNodes()) { // should occur no exceptions rn.commit(); // should have little effect in trans } t.cancel(); }