Skip to content

Commit

Permalink
Try to force orient graph shutdown so broken tests don't cascade.
Browse files Browse the repository at this point in the history
  • Loading branch information
Darrick Wiebe committed Dec 13, 2010
1 parent ab900b2 commit 6ea692b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @author Luca Garulli (http://www.orientechnologies.com)
*/
public class OrientGraphTest extends GraphTest {
private OrientGraph currentGraph;

public OrientGraphTest() {
this.allowsDuplicateEdges = true;
Expand Down Expand Up @@ -78,7 +79,8 @@ public void testGraphMLReaderTestSuite() throws Exception {

public Graph getGraphInstance() {
String directory = getWorkingDirectory();
return new OrientGraph("local:" + directory + "/graph");
this.currentGraph = new OrientGraph("local:" + directory + "/graph");
return this.currentGraph;
}

public void doTestSuite(final TestSuite testSuite) throws Exception {
Expand All @@ -90,6 +92,10 @@ public void doTestSuite(final TestSuite testSuite) throws Exception {
if (method.getName().startsWith("test")) {
System.out.println("Testing " + method.getName() + "...");
method.invoke(testSuite);
try {
if (this.currentGraph != null)
this.currentGraph.shutdown();
} catch (Exception e) { }
new ODatabaseGraphTx("local:" + directory + "/graph").delete();
}
}
Expand Down

0 comments on commit 6ea692b

Please sign in to comment.