|
60 | 60 | import com.arangodb.entity.CollectionType;
|
61 | 61 | import com.arangodb.entity.CursorEntity.Warning;
|
62 | 62 | import com.arangodb.entity.DatabaseEntity;
|
| 63 | +import com.arangodb.entity.EdgeDefinition; |
63 | 64 | import com.arangodb.entity.GraphEntity;
|
64 | 65 | import com.arangodb.entity.IndexEntity;
|
65 | 66 | import com.arangodb.entity.PathEntity;
|
|
75 | 76 | import com.arangodb.model.AqlQueryOptions;
|
76 | 77 | import com.arangodb.model.CollectionCreateOptions;
|
77 | 78 | import com.arangodb.model.CollectionsReadOptions;
|
| 79 | +import com.arangodb.model.GraphCreateOptions; |
78 | 80 | import com.arangodb.model.TransactionOptions;
|
79 | 81 | import com.arangodb.model.TraversalOptions;
|
80 | 82 | import com.arangodb.model.TraversalOptions.Direction;
|
@@ -1027,6 +1029,52 @@ public void createGraph() {
|
1027 | 1029 | }
|
1028 | 1030 | }
|
1029 | 1031 |
|
| 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 | + |
1030 | 1078 | @Test
|
1031 | 1079 | public void getGraphs() {
|
1032 | 1080 | try {
|
|
0 commit comments