8000 Add graph tests · MladenMitev/arangodb-java-driver@c80f269 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c80f269

Browse files
author
mpv1989
committed
Add graph tests
1 parent 6bbe54b commit c80f269

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/test/java/com/arangodb/ArangoDatabaseTest.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import com.arangodb.entity.CollectionType;
6161
import com.arangodb.entity.CursorEntity.Warning;
6262
import com.arangodb.entity.DatabaseEntity;
63+
import com.arangodb.entity.EdgeDefinition;
6364
import com.arangodb.entity.GraphEntity;
6465
import com.arangodb.entity.IndexEntity;
6566
import com.arangodb.entity.PathEntity;
@@ -75,6 +76,7 @@
7576
import com.arangodb.model.AqlQueryOptions;
7677
import com.arangodb.model.CollectionCreateOptions;
7778
import com.arangodb.model.CollectionsReadOptions;
79+
import com.arangodb.model.GraphCreateOptions;
7880
import com.arangodb.model.TransactionOptions;
7981
import com.arangodb.model.TraversalOptions;
8082
import com.arangodb.model.TraversalOptions.Direction;
@@ -1027,6 +1029,52 @@ public void createGraph() {
10271029
}
10281030
}
10291031

1032+
@Test
1033+
public void createGraphReplicationFaktor() {
1034+
if (arangoDB.getRole() == ServerRole.SINGLE) {
1035+
return;
1036+
}
1037+
try {
1038+
final String edgeCollection = COLLECTION_NAME + "edge";
1039+
final String fromCollection = COLLECTION_NAME + "from";
1040+
final String toCollection = COLLECTION_NAME + "to";
1041+
final Collection<EdgeDefinition> edgeDefinitions = Arrays
1042+
.asList(new EdgeDefinition().collection(edgeCollection).from(fromCollection).to(toCollection));
1043+
final GraphEntity result = db.createGraph(GRAPH_NAME, edgeDefinitions,
1044+
new GraphCreateOptions().replicationFactor(2));
1045+
assertThat(result, is(notNullValue()));
1046+
for (final String collection : Arrays.asList(edgeCollection, fromCollection, toCollection)) {
1047+
final CollectionPropertiesEntity properties = db.collection(collection).getProperties();
1048+
assertThat(properties.getReplicationFactor(), is(2));
1049+
}
1050+
} finally {
1051+
db.graph(GRAPH_NAME).drop();
1052+
}
1053+
}
1054+
1055+
@Test
1056+
public void createGraphNumberOfShards() {
1057+
if (arangoDB.getRole() == ServerRole.SINGLE) {
1058+
return;
1059+
}
1060+
try {
1061+
final String edgeCollection = COLLECTION_NAME + "edge";
1062+
final String fromCollection = COLLECTION_NAME + "from";
1063+
final String toCollection = COLLECTION_NAME + "to";
1064+
final Collection<EdgeDefinition> edgeDefinitions = Arrays
1065+
.asList(new EdgeDefinition().collection(edgeCollection).from(fromCollection).to(toCollection));
1066+
final GraphEntity result = db.createGraph(GRAPH_NAME, edgeDefinitions,
1067+
new GraphCreateOptions().numberOfShards(2));
1068+
assertThat(result, is(notNullValue()));
1069+
for (final String collection : Arrays.asList(edgeCollection, fromCollection, toCollection)) {
1070+
final CollectionPropertiesEntity properties = db.collection(collection).getProperties();
1071+
assertThat(properties.getNumberOfShards(), is(2));
1072+
}
1073+
} finally {
1074+
db.graph(GRAPH_NAME).drop();
1075+
}
1076+
}
1077+
10301078
@Test
10311079
public void getGraphs() {
10321080
try {

0 commit comments

Comments
 (0)
0