Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit 62b6c0a

Browse files
committed
tests fixes
1 parent 0dec396 commit 62b6c0a

File tree

3 files changed

+61
-145
lines changed

3 files changed

+61
-145
lines changed

src/main/java/com/arangodb/tinkerpop/gremlin/client/ArangoDBGraphClient.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.util.regex.Pattern;
1414
import java.util.stream.Collectors;
1515

16+
import com.arangodb.*;
1617
import com.arangodb.config.ArangoConfigProperties;
1718
import com.arangodb.entity.*;
1819
import com.arangodb.model.*;
@@ -27,12 +28,6 @@
2728
import org.slf4j.Logger;
2829
import org.slf4j.LoggerFactory;
2930

30-
import com.arangodb.ArangoCollection;
31-
import com.arangodb.ArangoCursor;
32-
import com.arangodb.ArangoDB;
33-
import com.arangodb.ArangoDBException;
34-
import com.arangodb.ArangoDatabase;
35-
import com.arangodb.ArangoGraph;
3631
import com.arangodb.tinkerpop.gremlin.utils.ArangoDBUtil;
3732

3833
import static com.arangodb.tinkerpop.gremlin.utils.ArangoDBUtil.getArangoDirectionFromGremlinDirection;
@@ -281,7 +276,7 @@ public void updateGraphVariables(ArangoDBGraphVariables document) {
281276
* @return ArangoDBBaseQuery the query object
282277
*/
283278

284-
public ArangoCursor<VertexData> getGraphVertices(final List<String> ids) {
279+
public ArangoIterable<VertexData> getGraphVertices(final List<String> ids) {
285280
logger.debug("Get all {} graph vertices, filtered by ids: {}", graph.name(), ids);
286281
List<String> prefixedColNames = graph.vertexCollections().stream().map(graph::getPrefixedCollectioName).collect(Collectors.toList());
287282
return getGraphDocuments(ids, prefixedColNames, VertexData.class);
@@ -293,13 +288,13 @@ public ArangoCursor<VertexData> getGraphVertices(final List<String> ids) {
293288
* @param ids the ids to match
294289
* @return ArangoDBBaseQuery the query object
295290
*/
296-
public ArangoCursor<EdgeData> getGraphEdges(List<String> ids) {
291+
public ArangoIterable<EdgeData> getGraphEdges(List<String> ids) {
297292
logger.debug("Get all {} graph edges, filtered by ids: {}", graph.name(), ids);
298293
List<String> prefixedColNames = graph.edgeCollections().stream().map(graph::getPrefixedCollectioName).collect(Collectors.toList());
299294
return getGraphDocuments(ids, prefixedColNames, EdgeData.class);
300295
}
301296

302-
private <V> ArangoCursor<V> getGraphDocuments(List<String> ids, List<String> prefixedColNames, Class<V> clazz) {
297+
private <V> ArangoIterable<V> getGraphDocuments(List<String> ids, List<String> prefixedColNames, Class<V> clazz) {
303298
Map<String, Object> bindVars = new HashMap<>();
304299
ArangoDBQueryBuilder queryBuilder = new ArangoDBQueryBuilder();
305300
if (ids.isEmpty()) {
@@ -309,7 +304,10 @@ private <V> ArangoCursor<V> getGraphDocuments(List<String> ids, List<String> pre
309304
queryBuilder.iterateCollection("d", prefixedColNames.get(0), bindVars);
310305
}
311306
} else {
312-
queryBuilder.with(prefixedColNames, bindVars).documentsById(ids, "d", bindVars);
307+
List<String> prunedIds = ids.stream()
308+
.filter(it -> prefixedColNames.contains(ArangoDBUtil.extractCollection(it)))
309+
.collect(Collectors.toList());
310+
queryBuilder.with(prefixedColNames, bindVars).documentsById(prunedIds, "d", bindVars);
313311
}
314312
queryBuilder.ret("d");
315313
String query = queryBuilder.toString();

src/main/java/com/arangodb/tinkerpop/gremlin/structure/ArangoDBGraph.java

Lines changed: 20 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -202,28 +202,16 @@
202202
method = "*",
203203
reason = "replaced by com.arangodb.tinkerpop.gremlin.custom.process.traversal.step.OrderabilityTest"
204204
)
205+
@Graph.OptOut(
206+
test = "org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SubgraphTest$Traversals",
207+
method = "*",
208+
reason = "FIXME: DE-996"
209+
)
205210
public class ArangoDBGraph implements Graph {
206211

207-
/**
208-
* The Class ArangoDBGraphFeatures.
209-
*/
210-
211-
public class ArangoDBGraphFeatures implements Features {
212-
213-
/**
214-
* The Class ArangoDBGraphGraphFeatures.
215-
*/
216-
217-
protected class ArangoDBGraphGraphFeatures implements GraphFeatures {
212+
public static class ArangoDBGraphFeatures implements Features {
218213

219-
/**
220-
* The variable features.
221-
*/
222-
private VariableFeatures variableFeatures = new ArangoDBGraphVariables.ArangoDBGraphVariableFeatures();
223-
224-
/**
225-
* Instantiates a new ArangoDB graph graph features.
226-
*/
214+
protected static class ArangoDBGraphGraphFeatures implements GraphFeatures {
227215

228216
protected ArangoDBGraphGraphFeatures() {
229217
}
@@ -245,19 +233,11 @@ public boolean supportsTransactions() {
245233

246234
@Override
247235
public VariableFeatures variables() {
248-
return variableFeatures;
236+
return new ArangoDBGraphVariables.ArangoDBGraphVariableFeatures();
249237
}
250238
}
251239

252-
/**
253-
* The Class ArangoDBGraphElementFeatures.
254-
*/
255-
256-
protected class ArangoDBGraphElementFeatures implements ElementFeatures {
257-
258-
/**
259-
* Instantiates a new ArangoDB graph element features.
260-
*/
240+
protected static class ArangoDBGraphElementFeatures implements ElementFeatures {
261241

262242
protected ArangoDBGraphElementFeatures() {
263243
}
@@ -289,65 +269,29 @@ public boolean supportsUuidIds() {
289269
}
290270
}
291271

292-
/**
293-
* The Class ArangoDBGraphVertexFeatures.
294-
*/
295-
296-
protected class ArangoDBGraphVertexFeatures extends ArangoDBGraphElementFeatures implements VertexFeatures {
297-
298-
/**
299-
* The vertex property features.
300-
*/
301-
302-
private final VertexPropertyFeatures vertexPropertyFeatures = new ArangoDBGraphVertexPropertyFeatures();
303-
304-
/**
305-
* Instantiates a new ArangoDB graph vertex features.
306-
*/
272+
protected static class ArangoDBGraphVertexFeatures extends ArangoDBGraphElementFeatures implements VertexFeatures {
307273

308274
protected ArangoDBGraphVertexFeatures() {
309275
}
310276

311-
312277
@Override
313278
public VertexPropertyFeatures properties() {
314-
return vertexPropertyFeatures;
279+
return new ArangoDBGraphVertexPropertyFeatures();
315280
}
316281
}
317282

318-
/**
319-
* The Class ArangoDBGraphEdgeFeatures.
320-
*/
321-
public class ArangoDBGraphEdgeFeatures extends ArangoDBGraphElementFeatures implements EdgeFeatures {
322-
323-
/**
324-
* The edge property features.
325-
*/
326-
327-
private final EdgePropertyFeatures edgePropertyFeatures = new ArangoDBGraphEdgePropertyFeatures();
328-
329-
/**
330-
* Instantiates a new ArangoDB graph edge features.
331-
*/
283+
public static class ArangoDBGraphEdgeFeatures extends ArangoDBGraphElementFeatures implements EdgeFeatures {
332284

333285
protected ArangoDBGraphEdgeFeatures() {
334286
}
335287

336288
@Override
337289
public EdgePropertyFeatures properties() {
338-
return edgePropertyFeatures;
290+
return new ArangoDBGraphEdgePropertyFeatures();
339291
}
340292
}
341293

342-
/**
343-
* The Class ArangoDBGraphVertexPropertyFeatures.
344-
*/
345-
346-
protected class ArangoDBGraphVertexPropertyFeatures implements VertexPropertyFeatures {
347-
348-
/**
349-
* Instantiates a new ArangoDB graph vertex property features.
350-
*/
294+
protected static class ArangoDBGraphVertexPropertyFeatures implements VertexPropertyFeatures {
351295

352296
protected ArangoDBGraphVertexPropertyFeatures() {
353297
}
@@ -379,45 +323,21 @@ public boolean supportsUuidIds() {
379323
}
380324
}
381325

382-
/**
383-
* The Class ArangoDBGraphEdgePropertyFeatures.
384-
*/
385-
protected class ArangoDBGraphEdgePropertyFeatures implements EdgePropertyFeatures {
386-
387-
/**
388-
* Instantiates a new ArangoDB graph edge property features.
389-
*/
326+
protected static class ArangoDBGraphEdgePropertyFeatures implements EdgePropertyFeatures {
390327

391328
protected ArangoDBGraphEdgePropertyFeatures() {
392329
}
393-
}
394-
395-
/**
396-
* The graph features.
397-
*/
398-
399-
protected GraphFeatures graphFeatures = new ArangoDBGraphGraphFeatures();
400-
401-
/**
402-
* The vertex features.
403-
*/
404330

405-
protected VertexFeatures vertexFeatures = new ArangoDBGraphVertexFeatures();
406-
407-
/**
408-
* The edge features.
409-
*/
410-
411-
protected EdgeFeatures edgeFeatures = new ArangoDBGraphEdgeFeatures();
331+
}
412332

413333
@Override
414334
public EdgeFeatures edge() {
415-
return edgeFeatures;
335+
return new ArangoDBGraphEdgeFeatures();
416336
}
417337

418338
@Override
419339
public GraphFeatures graph() {
420-
return graphFeatures;
340+
return new ArangoDBGraphGraphFeatures();
421341
}
422342

423343
@Override
@@ -427,7 +347,7 @@ public String toString() {
427347

428348
@Override
429349
public VertexFeatures vertex() {
430-
return vertexFeatures;
350+
return new ArangoDBGraphVertexFeatures();
431351
}
432352
}
433353

@@ -551,7 +471,7 @@ public VertexFeatures vertex() {
551471
* The configuration.
552472
*/
553473

554-
private Configuration configuration;
474+
private final Configuration configuration;
555475

556476

557477
/**

src/test/java/com/arangodb/tinkerpop/gremlin/custom/CustomGraph.java

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,50 @@
33
import com.arangodb.tinkerpop.gremlin.structure.ArangoDBGraph;
44
import org.apache.commons.configuration2.Configuration;
55

6-
76
public class CustomGraph extends ArangoDBGraph {
87

8+
@SuppressWarnings("unused")
99
public static CustomGraph open(Configuration configuration) {
1010
return new CustomGraph(configuration);
1111
}
1212

13-
class CustomFeatures extends ArangoDBGraph.ArangoDBGraphFeatures {
14-
15-
@Override
16-
public EdgeFeatures edge() {
17-
return new ArangoDBGraphEdgeFeatures() {
18-
@Override
19-
public boolean supportsNumericIds() {
20-
return true;
21-
}
22-
};
23-
}
24-
25-
@Override
26-
public VertexFeatures vertex() {
27-
return new ArangoDBGraphVertexFeatures() {
28-
@Override
29-
public boolean supportsNumericIds() {
30-
return true;
31-
}
32-
33-
@Override
34-
public VertexPropertyFeatures properties() {
35-
return new ArangoDBGraphVertexPropertyFeatures() {
36-
@Override
37-
public boolean supportsNumericIds() {
38-
return true;
39-
}
40-
};
41-
}
42-
};
43-
}
44-
}
45-
4613
public CustomGraph(Configuration configuration) {
4714
super(configuration);
4815
}
4916

5017
@Override
5118
public Features features() {
52-
return new CustomFeatures();
19+
return new ArangoDBGraph.ArangoDBGraphFeatures() {
20+
21+
@Override
22+
public Features.EdgeFeatures edge() {
23+
return new ArangoDBGraphFeatures.ArangoDBGraphEdgeFeatures() {
24+
@Override
25+
public boolean supportsNumericIds() {
26+
return true;
27+
}
28+
};
29+
}
30+
31+
@Override
32+
public Features.VertexFeatures vertex() {
33+
return new ArangoDBGraphFeatures.ArangoDBGraphVertexFeatures() {
34+
@Override
35+
public boolean supportsNumericIds() {
36+
return true;
37+
}
38+
39+
@Override
40+
public Features.VertexPropertyFeatures properties() {
41+
return new ArangoDBGraphFeatures.ArangoDBGraphVertexPropertyFeatures() {
42+
@Override
43+
public boolean supportsNumericIds() {
44+
return true;
45+
}
46+
};
47+
}
48+
};
49+
}
50+
};
5351
}
5452
}

0 commit comments

Comments
 (0)