Skip to content

Commit fc8eb5d

Browse files
Dassi orleandomaibin
authored andcommitted
BAEL-1216: improve tests (eugenp#3309)
1 parent 620abb2 commit fc8eb5d

1 file changed

Lines changed: 35 additions & 44 deletions

File tree

‎orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPITest.java‎

Lines changed: 35 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -21,50 +21,41 @@ public static void setup() {
2121

2222
// @BeforeClass
2323
public static void init() {
24-
boolean articleExists = graph.getVertexType("Article") != null;
25-
boolean writerExists = graph.getVertexType("Writer") != null;
26-
boolean authorExists = graph.getVertexType("Author") != null;
27-
boolean editorExists = graph.getVertexType("Editor") != null;
28-
29-
boolean classesExist = articleExists && writerExists && authorExists && editorExists;
30-
31-
if(!classesExist) {
32-
graph.createVertexType("Article");
33-
34-
OrientVertexType writerType = graph.createVertexType("Writer");
35-
writerType.setStrictMode(true);
36-
writerType.createProperty("firstName", OType.STRING);
37-
writerType.createProperty("lastName", OType.STRING);
38-
writerType.createProperty("country", OType.STRING);
39-
40-
OrientVertexType authorType = graph.createVertexType("Author", "Writer");
41-
authorType.createProperty("level", OType.INTEGER).setMax("3");
42-
43-
OrientVertexType editorType = graph.createVertexType("Editor", "Writer");
44-
editorType.createProperty("level", OType.INTEGER).setMin("3");
45-
46-
Vertex vEditor = graph.addVertex("class:Editor");
47-
vEditor.setProperty("firstName", "Maxim");
48-
vEditor.setProperty("lastName", "Mink's");
49-
vEditor.setProperty("country", "Cameroon");
50-
vEditor.setProperty("publicProfile", true);
51-
vEditor.setProperty("level", "7");
52-
53-
Vertex vAuthor = graph.addVertex("class:Author");
54-
vAuthor.setProperty("firstName", "Jerome");
55-
vAuthor.setProperty("country", "Romania");
56-
vAuthor.setProperty("publicProfile", false);
57-
vAuthor.setProperty("level", "3");
58-
59-
Vertex vArticle = graph.addVertex("class:Article");
60-
vArticle.setProperty("title", "Introduction to the OrientDB Java APIs.");
61-
vArticle.setProperty("priority", "High");
62-
vArticle.setProperty("type", "Article");
63-
vArticle.setProperty("level", "+L4");
64-
65-
graph.addEdge(null, vAuthor, vEditor, "has");
66-
graph.addEdge(null, vAuthor, vArticle, "wrote");
67-
}
24+
graph.createVertexType("Article");
25+
26+
OrientVertexType writerType = graph.createVertexType("Writer");
27+
writerType.setStrictMode(true);
28+
writerType.createProperty("firstName", OType.STRING);
29+
writerType.createProperty("lastName", OType.STRING);
30+
writerType.createProperty("country", OType.STRING);
31+
32+
OrientVertexType authorType = graph.createVertexType("Author", "Writer");
33+
authorType.createProperty("level", OType.INTEGER).setMax("3");
34+
35+
OrientVertexType editorType = graph.createVertexType("Editor", "Writer");
36+
editorType.createProperty("level", OType.INTEGER).setMin("3");
37+
38+
Vertex vEditor = graph.addVertex("class:Editor");
39+
vEditor.setProperty("firstName", "Maxim");
40+
vEditor.setProperty("lastName", "Mink's");
41+
vEditor.setProperty("country", "Cameroon");
42+
vEditor.setProperty("publicProfile", true);
43+
vEditor.setProperty("level", "7");
44+
45+
Vertex vAuthor = graph.addVertex("class:Author");
46+
vAuthor.setProperty("firstName", "Jerome");
47+
vAuthor.setProperty("country", "Romania");
48+
vAuthor.setProperty("publicProfile", false);
49+
vAuthor.setProperty("level", "3");
50+
51+
Vertex vArticle = graph.addVertex("class:Article");
52+
vArticle.setProperty("title", "Introduction to the OrientDB Java APIs.");
53+
vArticle.setProperty("priority", "High");
54+
vArticle.setProperty("type", "Article");
55+
vArticle.setProperty("level", "+L4");
56+
57+
graph.addEdge(null, vAuthor, vEditor, "has");
58+
graph.addEdge(null, vAuthor, vArticle, "wrote");
6859
}
6960

7061
// @Test

0 commit comments

Comments
 (0)