BAEL-1216: improve tests (#3309)
This commit is contained in:
parent
620abb2753
commit
fc8eb5dc98
|
@ -21,50 +21,41 @@ public class OrientDBGraphAPITest {
|
||||||
|
|
||||||
// @BeforeClass
|
// @BeforeClass
|
||||||
public static void init() {
|
public static void init() {
|
||||||
boolean articleExists = graph.getVertexType("Article") != null;
|
graph.createVertexType("Article");
|
||||||
boolean writerExists = graph.getVertexType("Writer") != null;
|
|
||||||
boolean authorExists = graph.getVertexType("Author") != null;
|
|
||||||
boolean editorExists = graph.getVertexType("Editor") != null;
|
|
||||||
|
|
||||||
boolean classesExist = articleExists && writerExists && authorExists && editorExists;
|
OrientVertexType writerType = graph.createVertexType("Writer");
|
||||||
|
writerType.setStrictMode(true);
|
||||||
|
writerType.createProperty("firstName", OType.STRING);
|
||||||
|
writerType.createProperty("lastName", OType.STRING);
|
||||||
|
writerType.createProperty("country", OType.STRING);
|
||||||
|
|
||||||
if(!classesExist) {
|
OrientVertexType authorType = graph.createVertexType("Author", "Writer");
|
||||||
graph.createVertexType("Article");
|
authorType.createProperty("level", OType.INTEGER).setMax("3");
|
||||||
|
|
||||||
OrientVertexType writerType = graph.createVertexType("Writer");
|
OrientVertexType editorType = graph.createVertexType("Editor", "Writer");
|
||||||
writerType.setStrictMode(true);
|
editorType.createProperty("level", OType.INTEGER).setMin("3");
|
||||||
writerType.createProperty("firstName", OType.STRING);
|
|
||||||
writerType.createProperty("lastName", OType.STRING);
|
|
||||||
writerType.createProperty("country", OType.STRING);
|
|
||||||
|
|
||||||
OrientVertexType authorType = graph.createVertexType("Author", "Writer");
|
Vertex vEditor = graph.addVertex("class:Editor");
|
||||||
authorType.createProperty("level", OType.INTEGER).setMax("3");
|
vEditor.setProperty("firstName", "Maxim");
|
||||||
|
vEditor.setProperty("lastName", "Mink's");
|
||||||
|
vEditor.setProperty("country", "Cameroon");
|
||||||
|
vEditor.setProperty("publicProfile", true);
|
||||||
|
vEditor.setProperty("level", "7");
|
||||||
|
|
||||||
OrientVertexType editorType = graph.createVertexType("Editor", "Writer");
|
Vertex vAuthor = graph.addVertex("class:Author");
|
||||||
editorType.createProperty("level", OType.INTEGER).setMin("3");
|
vAuthor.setProperty("firstName", "Jerome");
|
||||||
|
vAuthor.setProperty("country", "Romania");
|
||||||
|
vAuthor.setProperty("publicProfile", false);
|
||||||
|
vAuthor.setProperty("level", "3");
|
||||||
|
|
||||||
Vertex vEditor = graph.addVertex("class:Editor");
|
Vertex vArticle = graph.addVertex("class:Article");
|
||||||
vEditor.setProperty("firstName", "Maxim");
|
vArticle.setProperty("title", "Introduction to the OrientDB Java APIs.");
|
||||||
vEditor.setProperty("lastName", "Mink's");
|
vArticle.setProperty("priority", "High");
|
||||||
vEditor.setProperty("country", "Cameroon");
|
vArticle.setProperty("type", "Article");
|
||||||
vEditor.setProperty("publicProfile", true);
|
vArticle.setProperty("level", "+L4");
|
||||||
vEditor.setProperty("level", "7");
|
|
||||||
|
|
||||||
Vertex vAuthor = graph.addVertex("class:Author");
|
graph.addEdge(null, vAuthor, vEditor, "has");
|
||||||
vAuthor.setProperty("firstName", "Jerome");
|
graph.addEdge(null, vAuthor, vArticle, "wrote");
|
||||||
vAuthor.setProperty("country", "Romania");
|
|
||||||
vAuthor.setProperty("publicProfile", false);
|
|
||||||
vAuthor.setProperty("level", "3");
|
|
||||||
|
|
||||||
Vertex vArticle = graph.addVertex("class:Article");
|
|
||||||
vArticle.setProperty("title", "Introduction to the OrientDB Java APIs.");
|
|
||||||
vArticle.setProperty("priority", "High");
|
|
||||||
vArticle.setProperty("type", "Article");
|
|
||||||
vArticle.setProperty("level", "+L4");
|
|
||||||
|
|
||||||
graph.addEdge(null, vAuthor, vEditor, "has");
|
|
||||||
graph.addEdge(null, vAuthor, vArticle, "wrote");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
|
|
Loading…
Reference in New Issue