Skip to content

Commit

Permalink
Added a test case trying producing issue #5089
Browse files Browse the repository at this point in the history
  • Loading branch information
lvca committed Oct 12, 2015
1 parent 1b7171c commit e4c794c
Showing 1 changed file with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.orientechnologies.orient.graph.blueprints;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -27,6 +28,7 @@
import com.orientechnologies.orient.core.metadata.schema.OSchema;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.impls.orient.OrientEdge;
import com.tinkerpop.blueprints.impls.orient.OrientEdgeType;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientGraphFactory;
Expand Down Expand Up @@ -121,6 +123,37 @@ public void fail() {
}
}

@Test
public void edgesCannotBeVertices() {
OrientGraphNoTx gNoTx = new OrientGraphNoTx("remote:localhost/pokec", "admin", "admin");
try {
OrientVertex v = gNoTx.addVertex(null);
OrientVertex loadedV = gNoTx.getVertex(v.getIdentity());
try {
OrientEdge e = gNoTx.getEdge(v.getIdentity().toString());
Assert.fail();
} catch (IllegalArgumentException e) {
// OK
}
} finally {
gNoTx.shutdown();
}

OrientGraph g = new OrientGraph("remote:localhost/pokec", "admin", "admin");
try {
OrientVertex v = g.addVertex(null);
OrientVertex loadedV = g.getVertex(v.getIdentity().toString());
try {
OrientEdge e = g.getEdge(v.getIdentity());
Assert.fail();
} catch (IllegalArgumentException e) {
// OK
}
} finally {
g.shutdown();
}
}

private void setupSchema() {
OrientGraphNoTx graphNoTx = new OrientGraphNoTx(URL, "admin", "admin");
try {
Expand All @@ -146,5 +179,4 @@ private void setupSchema() {
graphNoTx.shutdown();
}
}

}

0 comments on commit e4c794c

Please sign in to comment.