Skip to content

Commit

Permalink
Merge branch '3.7-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazcy committed Nov 29, 2024
2 parents 56c72f6 + cc74c84 commit 0b70b4c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -75,9 +75,9 @@ public static SeedStrategy create(final Configuration configuration) {

@Override
public Configuration getConfiguration() {
final Map<String, Object> map = new HashMap<>();
map.put(STRATEGY, SeedStrategy.class.getCanonicalName());
final Map<String, Object> map = new LinkedHashMap<>();
map.put(ID_SEED, this.seed);
map.put(STRATEGY, SeedStrategy.class.getCanonicalName());
return new MapConfiguration(map);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -310,14 +310,14 @@ private Traversal.Admin<Edge, Vertex> getVertexPredicateGivenDirection(final Dir

@Override
public Configuration getConfiguration() {
final Map<String, Object> map = new HashMap<>();
final Map<String, Object> map = new LinkedHashMap<>();
map.put(CHECK_ADJACENT_VERTICES, this.checkAdjacentVertices);
if (null != this.vertexCriterion)
map.put(VERTICES, this.vertexCriterion);
if (null != this.edgeCriterion)
map.put(EDGES, this.edgeCriterion);
if (null != this.vertexPropertyCriterion)
map.put(VERTEX_PROPERTIES, this.vertexPropertyCriterion);
map.put(CHECK_ADJACENT_VERTICES, this.checkAdjacentVertices);
return new MapConfiguration(map);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
Expand Down Expand Up @@ -73,7 +73,7 @@ public void apply(final Traversal.Admin<?, ?> traversal) {

@Override
public Configuration getConfiguration() {
final Map<String, Object> m = new HashMap<>(2);
final Map<String, Object> m = new LinkedHashMap<>(2);
m.put(THROW_EXCEPTION, this.throwException);
m.put(LOG_WARNING, this.logWarning);
return new MapConfiguration(m);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.stream.Collectors;

Expand All @@ -48,7 +48,7 @@
public class ReservedKeysVerificationStrategy extends AbstractWarningVerificationStrategy {

public static final String KEYS = "keys";
private static final Set<String> DEFAULT_RESERVED_KEYS = new HashSet<>(Arrays.asList("id", "label"));
private static final Set<String> DEFAULT_RESERVED_KEYS = new LinkedHashSet<>(Arrays.asList("id", "label"));
private final Set<String> reservedKeys;

private ReservedKeysVerificationStrategy(final Builder builder) {
Expand Down Expand Up @@ -79,7 +79,7 @@ void verify(final Traversal.Admin<?, ?> traversal) throws VerificationException
public static ReservedKeysVerificationStrategy create(final Configuration configuration) {
return build()
.reservedKeys(configuration.getList(KEYS, new ArrayList<>(DEFAULT_RESERVED_KEYS)).
stream().map(Object::toString).collect(Collectors.toSet()))
stream().map(Object::toString).collect(Collectors.toCollection(LinkedHashSet::new)))
.throwException(configuration.getBoolean(THROW_EXCEPTION, false))
.logWarning(configuration.getBoolean(LOG_WARNING, false)).create();
}
Expand All @@ -101,7 +101,7 @@ public final static class Builder extends AbstractWarningVerificationStrategy.Bu
private Builder() {}

public Builder reservedKeys(final Set<String> keys) {
reservedKeys = keys;
this.reservedKeys = new LinkedHashSet<>(keys);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.junit.runners.Parameterized;

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;

import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.has;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.hasLabel;
Expand Down Expand Up @@ -71,7 +71,7 @@ public static Iterable<Object[]> generateTestParameters() {
{"new ReservedKeysVerificationStrategy(logWarning: true, throwException: true)", ReservedKeysVerificationStrategy.build().logWarning(true).throwException(true).create()},
{"ReservedKeysVerificationStrategy(logWarning: true, throwException: true)", ReservedKeysVerificationStrategy.build().logWarning(true).throwException(true).create()},
{"new ReservedKeysVerificationStrategy(logWarning: true, throwException: false)", ReservedKeysVerificationStrategy.build().logWarning(true).create()},
{"new ReservedKeysVerificationStrategy(keys: ['a','b'])", ReservedKeysVerificationStrategy.build().reservedKeys(new HashSet<>(Arrays.asList("a", "b"))).create()},
{"new ReservedKeysVerificationStrategy(keys: ['a','b'])", ReservedKeysVerificationStrategy.build().reservedKeys(new LinkedHashSet<>(Arrays.asList("a", "b"))).create()},
{"new SubgraphStrategy(vertices: hasLabel('person'))", SubgraphStrategy.build().vertices(hasLabel("person")).create()},
{"SubgraphStrategy(vertices: hasLabel('person'))", SubgraphStrategy.build().vertices(hasLabel("person")).create()},
{"new SubgraphStrategy(vertices: hasLabel('person'), edges: hasLabel('knows'), vertexProperties: has('time', between(1234, 4321)), checkAdjacentVertices: true)", SubgraphStrategy.build().vertices(hasLabel("person")).edges(hasLabel("knows")).vertexProperties(has("time", P.between(1234, 4321))).checkAdjacentVertices(true).create()},
Expand Down

0 comments on commit 0b70b4c

Please sign in to comment.