Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package com.orientechnologies.orient.graph.blueprints;
import java.io.File;
import java.io.IOException;
import com.orientechnologies.orient.core.db.ODatabaseComplex;
import com.orientechnologies.orient.core.db.ODatabasePoolBase;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;
public class GraphCreate {
private ODatabasePoolBase<ODatabaseDocumentTx> pool;
ODatabaseComplex<?> db;
@Before
public void setUp() throws IOException {
String path = System.getProperty("java.io.tmpdir") + "orientdbTest";
FileUtils.deleteDirectory(new File(path));
pool = new ODatabaseDocumentPool("plocal:" + path, "admin", "admin");
pool.setup(1, 10);
db = new ODatabaseDocumentTx("plocal:" + path);
if (!db.exists()) {
db.create();
}
}
@Test
public void testCreateAndDelete() {
OrientGraph graph = new OrientGraph(pool.acquire());
try {
for (Vertex v : graph.getVertices()) {
v.remove();
}
graph.commit();
} finally {
graph.shutdown();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.