Skip to content

Commit c69344c

Browse files
author
mpv1989
committed
Optimize tests for cluster
1 parent 11c0074 commit c69344c

File tree

5 files changed

+15
-34
lines changed

5 files changed

+15
-34
lines changed

src/test/java/com/arangodb/ArangoCollectionTest.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import java.util.Map;
4444

4545
import org.junit.After;
46-
import org.junit.Before;
4746
import org.junit.Test;
4847
import org.junit.runner.RunWith;
4948
import org.junit.runners.Parameterized;
@@ -87,16 +86,12 @@ public class ArangoCollectionTest extends BaseTest {
8786

8887
public ArangoCollectionTest(final Builder builder) {
8988
super(builder);
90-
}
91-
92-
@Before
93-
public void setup() {
9489
db.createCollection(COLLECTION_NAME, null);
9590
}
9691

9792
@After
9893
public void teardown() {
99-
db.collection(COLLECTION_NAME).drop();
94+
db.collection(COLLECTION_NAME).truncate();
10095
}
10196

10297
@Test

src/test/java/com/arangodb/ArangoEdgeCollectionTest.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.util.Collection;
3333

3434
import org.junit.After;
35-
import org.junit.Before;
3635
import org.junit.Test;
3736
import org.junit.runner.RunWith;
3837
import org.junit.runners.Parameterized;
@@ -64,9 +63,9 @@ public class ArangoEdgeCollectionTest extends BaseTest {
6463

6564
public ArangoEdgeCollectionTest(final Builder builder) {
6665
super(builder);
66+
setup();
6767
}
6868

69-
@Before
7069
public void setup() {
7170
try {
7271
db.createCollection(VERTEX_COLLECTION_NAME, null);
@@ -85,12 +84,8 @@ public void setup() {
8584
@After
8685
public void teardown() {
8786
for (final String collection : new String[] { VERTEX_COLLECTION_NAME, EDGE_COLLECTION_NAME }) {
88-
try {
89-
db.collection(collection).drop();
90-
} catch (final ArangoDBException e) {
91-
}
87+
db.collection(collection).truncate();
9288
}
93-
db.graph(GRAPH_NAME).drop();
9489
}
9590

9691
private BaseEdgeDocument createEdgeValue() {

src/test/java/com/arangodb/ArangoGraphTest.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.util.Iterator;
3333

3434
import org.junit.After;
35-
import org.junit.Before;
3635
import org.junit.Test;
3736
import org.junit.runner.RunWith;
3837
import org.junit.runners.Parameterized;
@@ -63,9 +62,9 @@ public class ArangoGraphTest extends BaseTest {
6362

6463
public ArangoGraphTest(final Builder builder) {
6564
super(builder);
65+
setup();
6666
}
6767

68-
@Before
6968
public void setup() {
7069
for (final String collection : new String[] { VERTEX_COL_1, VERTEX_COL_2, VERTEX_COL_2, VERTEX_COL_3,
7170
VERTEX_COL_4 }) {
@@ -92,12 +91,8 @@ public void setup() {
9291
public void teardown() {
9392
for (final String collection : new String[] { EDGE_COL_1, EDGE_COL_2, VERTEX_COL_1, VERTEX_COL_2, VERTEX_COL_3,
9493
VERTEX_COL_4 }) {
95-
try {
96-
db.collection(collection).drop();
97-
} catch (final ArangoDBException e) {
98-
}
94+
db.collection(collection).truncate();
9995
}
100-
db.graph(GRAPH_NAME).drop();
10196
}
10297

10398
@Test

src/test/java/com/arangodb/ArangoVertexCollectionTest.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import java.util.Collection;
3232

3333
import org.junit.After;
34-
import org.junit.Before;
3534
import org.junit.Test;
3635
import org.junit.runner.RunWith;
3736
import org.junit.runners.Parameterized;
@@ -58,9 +57,9 @@ public class ArangoVertexCollectionTest extends BaseTest {
5857

5958
public ArangoVertexCollectionTest(final Builder builder) {
6059
super(builder);
60+
setup();
6161
}
6262

63-
@Before
6463
public void setup() {
6564
try {
6665
db.createCollection(COLLECTION_NAME, null);
@@ -72,11 +71,7 @@ public void setup() {
7271

7372
@After
7473
public void teardown() {
75-
try {
76-
db.collection(COLLECTION_NAME).drop();
77-
} catch (final ArangoDBException e) {
78-
}
79-
db.graph(GRAPH_NAME).drop();
74+
db.collection(COLLECTION_NAME).truncate();
8075
}
8176

8277
@Test

src/test/java/com/arangodb/DocumentTest.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import java.util.Map;
2828

29-
import org.junit.Before;
29+
import org.junit.After;
3030
import org.junit.Test;
3131
import org.junit.runner.RunWith;
3232
import org.junit.runners.Parameterized;
@@ -47,16 +47,17 @@ public class DocumentTest extends BaseTest {
4747

4848
public DocumentTest(final Builder builder) {
4949
super(builder);
50+
setup();
5051
}
5152

52-
@Before
5353
public void setup() {
54-
collection = db.collection(COLLECTION_NAME);
55-
try {
56-
collection.drop();
57-
} catch (final ArangoDBException e) {
58-
}
5954
db.createCollection(COLLECTION_NAME);
55+
collection = db.collection(COLLECTION_NAME);
56+
}
57+
58+
@After
59+
public void teardown() {
60+
collection.truncate();
6061
}
6162

6263
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)