Skip to content

Commit 3a96ceb

Browse files
author
michele
committed
SimpleSyncPerfTest
1 parent 302bc20 commit 3a96ceb

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/test/java/perf/SimpleSyncPerfTest.java

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import java.util.Arrays;
3232
import java.util.Collection;
33+
import java.util.Date;
3334

3435
/**
3536
* @author Michele Rastelli
@@ -41,27 +42,36 @@ public class SimpleSyncPerfTest {
4142
private final ArangoDB arangoDB;
4243

4344
@Parameterized.Parameters
44-
public static Collection<ArangoDB> builders() {
45+
public static Collection<Protocol> protocols() {
4546
return Arrays.asList(
46-
new ArangoDB.Builder().useProtocol(Protocol.HTTP_VPACK).build(),
47-
new ArangoDB.Builder().useProtocol(Protocol.HTTP_JSON).build(),
48-
new ArangoDB.Builder().useProtocol(Protocol.VST).build()
47+
Protocol.HTTP_VPACK,
48+
Protocol.HTTP_JSON,
49+
Protocol.VST
4950
);
5051
}
5152

52-
public SimpleSyncPerfTest(final ArangoDB arangoDB) {
53-
this.arangoDB = arangoDB;
53+
public SimpleSyncPerfTest(final Protocol protocol) {
54+
System.out.println("---");
55+
System.out.println(protocol);
56+
this.arangoDB = new ArangoDB.Builder().useProtocol(protocol).build();
5457
}
5558

5659
@Before
5760
public void warmup() {
58-
getVersion();
61+
doGetVersion();
5962
}
6063

61-
@Test
62-
public void getVersion() {
64+
private void doGetVersion() {
6365
for (int i = 0; i < REPETITIONS; i++) {
6466
arangoDB.getVersion();
6567
}
6668
}
69+
70+
@Test
71+
public void getVersion() {
72+
long start = new Date().getTime();
73+
doGetVersion();
74+
long end = new Date().getTime();
75+
System.out.println("elapsed ms: " + (end - start));
76+
}
6777
}

0 commit comments

Comments
 (0)