Skip to content

Commit

Permalink
fixed case of removed vertex in the same transaction where is created…
Browse files Browse the repository at this point in the history
…, issue #4045
  • Loading branch information
tglman committed May 6, 2015
1 parent 453af94 commit 7a67852
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 172 deletions.
Expand Up @@ -117,7 +117,10 @@ protected boolean checkDeletedInTx() {
if (curGraph == null)
return false;
final ORecordOperation oper = curGraph.getRawGraph().getTransaction().getRecordEntry(getIdentity());
return oper != null && oper.type == ORecordOperation.DELETED;
if (oper == null)
return getIdentity().isTemporary();
else
return oper.type == ORecordOperation.DELETED;
}

/**
Expand Down
Expand Up @@ -23,6 +23,15 @@ public void after() {
grap.drop();
}

@Test(expected = IllegalStateException.class)
public void testAddEdgeOnRemovedVertexSameTransaction() {
Vertex v = grap.addVertex(null);
Vertex v1 = grap.addVertex(null);

v.remove();
v.addEdge("test", v1);
}

@Test(expected = IllegalStateException.class)
public void testAddEdgeOnRemovedVertex() {
Vertex v = grap.addVertex(null);
Expand All @@ -33,6 +42,16 @@ public void testAddEdgeOnRemovedVertex() {
v.addEdge("test", v1);
}

@Test(expected = IllegalStateException.class)
public void testAddEdgeToRemovedVertex() {
Vertex v = grap.addVertex(null);
Vertex v1 = grap.addVertex(null);
grap.commit();

v1.remove();
v.addEdge("test", v1);
}

@Test(expected = IllegalStateException.class)
public void testSetPropertyOnRemovedVertex() {
Vertex v = grap.addVertex(null);
Expand Down

0 comments on commit 7a67852

Please sign in to comment.