You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by co...@apache.org on 2026/04/14 19:52:35 UTC
(tinkerpop) branch TINKERPOP-3107 updated (e78ca26dae -> 4316f890ba)
This is an automated email from the ASF dual-hosted git repository.
colegreer pushed a change to branch TINKERPOP-3107
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
from e78ca26dae docs and tests
new b1fce1ff3c cleanups and fixes
new 4316f890ba add airroutes server config
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
docs/src/reference/gremlin-applications.asciidoc | 42 ++++++------
docs/src/upgrade/release-4.x.x.asciidoc | 8 +--
...r-modern.yaml => gremlin-server-airroutes.yaml} | 4 +-
.../gremlin/server/util/ServerGremlinExecutor.java | 15 ++---
.../server/util/TinkerFactoryDataLoader.java | 5 +-
.../server/GremlinServerConfigIntegrateTest.java | 23 ++-----
.../server/util/ServerGremlinExecutorTest.java | 77 ++++++++++++++--------
.../server/util/TinkerFactoryDataLoaderTest.java | 20 ++++++
8 files changed, 109 insertions(+), 85 deletions(-)
copy gremlin-server/conf/{gremlin-server-modern.yaml => gremlin-server-airroutes.yaml} (95%)
(tinkerpop) 01/02: cleanups and fixes
Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
colegreer pushed a commit to branch TINKERPOP-3107
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit b1fce1ff3c9ed1b5718ac98e4fee1b3d8de31ea5
Author: Cole Greer <Co...@improving.com>
AuthorDate: Tue Apr 14 12:52:02 2026 -0700
cleanups and fixes
---
docs/src/reference/gremlin-applications.asciidoc | 40 +++++------
docs/src/upgrade/release-4.x.x.asciidoc | 6 +-
.../gremlin/server/util/ServerGremlinExecutor.java | 15 ++---
.../server/GremlinServerConfigIntegrateTest.java | 22 +------
.../server/util/ServerGremlinExecutorTest.java | 77 ++++++++++++++--------
5 files changed, 80 insertions(+), 80 deletions(-)
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index 412612b42a..1d0d0a0c96 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -444,22 +444,22 @@ $ bin/gremlin-server.sh conf/gremlin-server-modern.yaml
(o o)
-----oOOo-(4)-oOOo-----
-[INFO] GremlinServer - Configuring Gremlin Server from conf/gremlin-server-modern.yaml
-[INFO] MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
-[INFO] DefaultGraphManager - Graph [graph] was successfully configured via [conf/tinkergraph-empty.properties].
-[INFO] ServerGremlinExecutor - Initialized Gremlin thread pool. Threads in pool named with pattern gremlin-*
-[INFO] ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
-[INFO] ServerGremlinExecutor - A GraphTraversalSource is now auto-bound to [g] for graph [graph]
-[INFO] ServerGremlinExecutor - Instantiated LifeCycleHook: org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader
-[INFO] GremlinServer - Executing start up LifeCycleHook
-[INFO] TinkerFactoryDataLoader - TinkerFactoryDataLoader loaded [modern] dataset into graph [graph]
-[INFO] GremlinServer - idleConnectionTimeout was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
-[INFO] GremlinServer - keepAliveInterval was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
-[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v4.0+json with org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4
-[INFO] AbstractChannelizer - Configured application/json with org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4
-[INFO] AbstractChannelizer - Configured application/vnd.graphbinary-v4.0 with org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4
-[INFO] GremlinServer$1 - Gremlin Server configured with worker thread pool of 1, gremlin pool of 4 and boss thread pool of 1.
-[INFO] GremlinServer$1 - Channel started at port 8182.
+[INFO] o.a.t.g.s.GremlinServer - Configuring Gremlin Server from conf/gremlin-server-modern.yaml
+[INFO] o.a.t.g.s.u.MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
+[INFO] o.a.t.g.s.u.DefaultGraphManager - Graph [graph] was successfully configured via [conf/tinkergraph-empty.properties].
+[INFO] o.a.t.g.s.u.ServerGremlinExecutor - Initialized Gremlin thread pool. Threads in pool named with pattern gremlin-*
+[INFO] o.a.t.g.s.u.ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
+[INFO] o.a.t.g.s.u.ServerGremlinExecutor - Initialized gremlin-lang GremlinScriptEngine and registered metrics
+[INFO] o.a.t.g.s.u.ServerGremlinExecutor - A GraphTraversalSource is now auto-bound to [g] for graph [graph]
+[INFO] o.a.t.g.s.u.ServerGremlinExecutor - Instantiated LifeCycleHook: org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader
+[INFO] o.a.t.g.s.h.TransactionManager - TransactionManager initialized with timeout=600000ms, maxTransactions=1000
+[INFO] o.a.t.g.s.GremlinServer - Executing start up LifeCycleHook
+[INFO] o.a.t.g.s.u.TinkerFactoryDataLoader - TinkerFactoryDataLoader loaded [modern] dataset into graph [graph]
+[INFO] o.a.t.g.s.AbstractChannelizer - Configured application/vnd.gremlin-v4.0+json with org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4
+[INFO] o.a.t.g.s.AbstractChannelizer - Configured application/json with org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4
+[INFO] o.a.t.g.s.AbstractChannelizer - Configured application/vnd.graphbinary-v4.0 with org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4
+[INFO] o.a.t.g.s.GremlinServer - Gremlin Server configured with worker thread pool of 1, gremlin pool of 10 and boss thread pool of 1.
+[INFO] o.a.t.g.s.GremlinServer - Channel started at port 8182.
----
Gremlin Server is configured by the provided link:http://www.yaml.org/[YAML] file `conf/gremlin-server-modern.yaml`.
@@ -505,7 +505,7 @@ strategy configuration via a Gremlin query:
----
traversalSources: {
g: {graph: graph},
- gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)"}}
+ gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)", language: "gremlin-lang"}}
----
Each entry supports:
@@ -513,8 +513,8 @@ Each entry supports:
* `graph` (required) — references a key in the `graphs` section
* `query` (optional) — a Gremlin expression evaluated with a base traversal source bound as `g`; the result becomes
the final `TraversalSource`
-* `language` (optional) — which script engine to use for query evaluation; defaults to `gremlin-lang` or the single
- configured non-`gremlin-lang` engine
+* `language` (optional) — which script engine to use for query evaluation; defaults to `gremlin-lang`, or the sole
+ configured engine if only one is present
Graphs with explicit `traversalSources` entries are excluded from auto-creation.
@@ -899,7 +899,7 @@ The following table describes the various YAML configuration options that Gremli
|traversalSources |A `Map` of `TraversalSource` configurations keyed by binding name. Each entry specifies a `graph` reference and optionally a `query` to configure strategies. See <<server-traversal-sources>>. |_none (auto-created from graphs)_
|traversalSources.<name>.graph |The name of the graph (as defined in `graphs`) to create the traversal source from. |_none_
|traversalSources.<name>.query |An optional Gremlin query evaluated with a base traversal source bound as `g`. The result becomes the final `TraversalSource`. |_none_
-|traversalSources.<name>.language |The script engine language to use for evaluating `query`. Falls back to the single configured non-`gremlin-lang` engine or `gremlin-lang`. |_auto-detected_
+|traversalSources.<name>.language |The script engine language to use for evaluating `query`. Falls back to the sole configured engine if only one is present, or `gremlin-lang` otherwise. |_auto-detected_
|lifecycleHooks |A `List` of Java-based `LifeCycleHook` implementations to instantiate and execute during server startup and shutdown. See <<server-lifecycle-hooks>>. |_none_
|lifecycleHooks[X].className |The fully qualified class name of the `LifeCycleHook` implementation. |_none_
|lifecycleHooks[X].config |A `Map` of configuration passed to the hook's `init(Map)` method. |_none_
diff --git a/docs/src/upgrade/release-4.x.x.asciidoc b/docs/src/upgrade/release-4.x.x.asciidoc
index c7c13e021b..6cd0fdabd4 100644
--- a/docs/src/upgrade/release-4.x.x.asciidoc
+++ b/docs/src/upgrade/release-4.x.x.asciidoc
@@ -61,15 +61,15 @@ A new `traversalSources` YAML section allows explicit `TraversalSource` creation
----
traversalSources: {
g: {graph: graph},
- gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)"}}
+ gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)", language: "gremlin-lang"}}
----
Each entry specifies:
- `graph` (required) — references a key in the `graphs` section
- `query` (optional) — a Gremlin expression evaluated with a base traversal source bound as `g`
-- `language` (optional) — which script engine to use for the query (defaults to `gremlin-lang`, or the single
- configured non-`gremlin-lang` engine if only one exists)
+- `language` (optional) — which script engine to use for the query (defaults to `gremlin-lang`, or the sole
+ configured engine if only one is present)
===== Java-Based `lifecycleHooks`
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index f3970b7a92..8f8b88e9a8 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@ -235,10 +235,8 @@ public class ServerGremlinExecutor {
// bind a base traversal source as 'g' for the query to operate on
final SimpleBindings bindings = new SimpleBindings();
bindings.put("g", graph.traversal());
- final GremlinExecutor.LifeCycle lifeCycle = GremlinExecutor.LifeCycle.build()
- .evaluationTimeoutOverride(0L).create();
final TraversalSource ts = (TraversalSource) gremlinExecutor.eval(
- tsSettings.query, language, bindings, lifeCycle).join();
+ tsSettings.query, language, bindings).join();
this.graphManager.putTraversalSource(tsName, ts);
logger.info("A {} is now bound to [{}] via query", ts.getClass().getSimpleName(), tsName);
} catch (Exception ex) {
@@ -309,18 +307,15 @@ public class ServerGremlinExecutor {
/**
* Resolves the script engine language to use for evaluating a traversal source query. If an explicit language
- * is provided, it is used directly. Otherwise, if only one non-{@code gremlin-lang} script engine is configured,
- * that engine is used. Falls back to {@code gremlin-lang}.
+ * is provided, it is used directly. Otherwise, if exactly one script engine is configured, that engine is used.
+ * Falls back to {@code gremlin-lang}.
*/
private String resolveLanguage(final String explicitLanguage) {
if (explicitLanguage != null && !explicitLanguage.isEmpty())
return explicitLanguage;
- final List<String> nonLangEngines = settings.scriptEngines.keySet().stream()
- .filter(name -> !name.equals("gremlin-lang"))
- .collect(Collectors.toList());
- if (nonLangEngines.size() == 1)
- return nonLangEngines.get(0);
+ if (settings.scriptEngines.size() == 1)
+ return settings.scriptEngines.keySet().iterator().next();
return "gremlin-lang";
}
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerConfigIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerConfigIntegrateTest.java
index 647bbba964..38e89cbddb 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerConfigIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerConfigIntegrateTest.java
@@ -22,7 +22,6 @@ import org.apache.tinkerpop.gremlin.driver.Client;
import org.apache.tinkerpop.gremlin.driver.Cluster;
import org.apache.tinkerpop.gremlin.driver.Result;
import org.apache.tinkerpop.gremlin.tinkergraph.structure.AbstractTinkerGraph;
-import org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -31,9 +30,9 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -47,7 +46,6 @@ import static org.hamcrest.Matchers.is;
public class GremlinServerConfigIntegrateTest {
private static final Logger logger = LoggerFactory.getLogger(GremlinServerConfigIntegrateTest.class);
- private static final int TEST_PORT = 45950;
@Parameterized.Parameter
public String configName;
@@ -70,24 +68,15 @@ public class GremlinServerConfigIntegrateTest {
final File confDir = new File(System.getProperty("build.dir"), "../conf");
final Settings settings = Settings.read(new FileInputStream(new File(confDir, configName)));
- settings.port = TEST_PORT;
+ settings.serializers = Collections.emptyList();
ServerTestHelper.rewritePathsInGremlinServerSettings(settings);
- // ensure a V4 serializer is available so the V4 client can connect
- if (!hasV4Serializer(settings)) {
- final Settings.SerializerSettings v4 = new Settings.SerializerSettings();
- v4.className = GraphBinaryMessageSerializerV4.class.getName();
- final List<Settings.SerializerSettings> serializers = new ArrayList<>(settings.serializers);
- serializers.add(v4);
- settings.serializers = serializers;
- }
-
final GremlinServer server = new GremlinServer(settings);
try {
server.start().join();
logger.info("Started server with config: {}", configName);
- final Cluster cluster = Cluster.build("localhost").port(TEST_PORT).create();
+ final Cluster cluster = Cluster.build("localhost").port(settings.port).create();
final Client client = cluster.connect();
try {
final List<Result> results = client.submit("g.inject(1)").all().get();
@@ -104,9 +93,4 @@ public class GremlinServerConfigIntegrateTest {
server.stop().join();
}
}
-
- private static boolean hasV4Serializer(final Settings settings) {
- return settings.serializers.stream()
- .anyMatch(s -> s.className.contains("V4"));
- }
}
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutorTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutorTest.java
index 03320268f7..489d4a6a5f 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutorTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutorTest.java
@@ -22,11 +22,10 @@ import org.apache.tinkerpop.gremlin.server.Settings;
import org.junit.After;
import org.junit.Test;
-import java.io.InputStream;
import java.lang.reflect.Method;
-import java.util.HashMap;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@@ -35,6 +34,10 @@ import static org.hamcrest.Matchers.nullValue;
public class ServerGremlinExecutorTest {
+ private static final String TINKERGRAPH_PROPERTIES =
+ new java.io.File(System.getProperty("build.dir"), "../src/test/scripts/tinkergraph-empty.properties")
+ .getAbsolutePath();
+
private ServerGremlinExecutor serverGremlinExecutor;
@After
@@ -50,48 +53,59 @@ public class ServerGremlinExecutorTest {
}
}
- private Settings readSettings(final String resource) {
- final InputStream stream = ServerGremlinExecutorTest.class.getResourceAsStream("../" + resource);
- final Settings settings = Settings.read(stream);
+ private Settings baseSettings() {
+ final Settings settings = new Settings();
+ settings.graphs.put("graph", TINKERGRAPH_PROPERTIES);
settings.gremlinPool = 1;
return settings;
}
@Test
public void shouldAutoCreateTraversalSourceForSingleGraph() {
- final Settings settings = readSettings("gremlin-server-minimal.yaml");
- serverGremlinExecutor = new ServerGremlinExecutor(settings, null, null);
+ serverGremlinExecutor = new ServerGremlinExecutor(baseSettings(), null, null);
- // graph named "graph" should auto-create traversal source named "g"
assertThat(serverGremlinExecutor.getGraphManager().getTraversalSource("g"), is(notNullValue()));
}
@Test
public void shouldAutoCreateTraversalSourceWithPrefixForNonDefaultGraph() {
- final Settings settings = readSettings("gremlin-server-minimal.yaml");
- settings.graphs.put("myGraph", settings.graphs.get("graph"));
+ final Settings settings = baseSettings();
+ settings.graphs.put("myGraph", TINKERGRAPH_PROPERTIES);
serverGremlinExecutor = new ServerGremlinExecutor(settings, null, null);
- // "graph" -> "g", "myGraph" -> "g_myGraph"
assertThat(serverGremlinExecutor.getGraphManager().getTraversalSource("g"), is(notNullValue()));
assertThat(serverGremlinExecutor.getGraphManager().getTraversalSource("g_myGraph"), is(notNullValue()));
}
@Test
public void shouldNotAutoCreateTraversalSourceWhenExplicitEntryExists() {
- final Settings settings = readSettings("gremlin-server-with-traversal-sources.yaml");
- // this YAML has explicit traversalSources for "g" referencing "graph"
+ final Settings settings = baseSettings();
+ final Settings.TraversalSourceSettings tsSettings = new Settings.TraversalSourceSettings();
+ tsSettings.graph = "graph";
+ settings.traversalSources.put("g", tsSettings);
serverGremlinExecutor = new ServerGremlinExecutor(settings, null, null);
- // "g" should exist from the explicit config
assertThat(serverGremlinExecutor.getGraphManager().getTraversalSource("g"), is(notNullValue()));
- // "g_graph" should NOT exist because "graph" had an explicit traversalSources entry
assertThat(serverGremlinExecutor.getGraphManager().getTraversalSource("g_graph"), is(nullValue()));
}
@Test
public void shouldInstantiateLifecycleHooksFromYaml() {
- final Settings settings = readSettings("gremlin-server-with-traversal-sources.yaml");
+ final Settings settings = baseSettings();
+ final Settings.LifeCycleHookSettings hook1 = new Settings.LifeCycleHookSettings();
+ hook1.className = TinkerFactoryDataLoader.class.getName();
+ hook1.config = new LinkedHashMap<>();
+ hook1.config.put("graph", "graph");
+ hook1.config.put("dataset", "modern");
+ final Settings.LifeCycleHookSettings hook2 = new Settings.LifeCycleHookSettings();
+ hook2.className = TinkerFactoryDataLoader.class.getName();
+ hook2.config = new LinkedHashMap<>();
+ hook2.config.put("graph", "graph");
+ hook2.config.put("dataset", "classic");
+ final List<Settings.LifeCycleHookSettings> hooks = new ArrayList<>();
+ hooks.add(hook1);
+ hooks.add(hook2);
+ settings.lifecycleHooks = hooks;
serverGremlinExecutor = new ServerGremlinExecutor(settings, null, null);
assertThat(serverGremlinExecutor.getHooks().size(), is(2));
@@ -101,17 +115,14 @@ public class ServerGremlinExecutorTest {
@Test
public void shouldHaveEmptyHooksWhenNoneConfigured() {
- final Settings settings = readSettings("gremlin-server-minimal.yaml");
- settings.lifecycleHooks.clear();
- serverGremlinExecutor = new ServerGremlinExecutor(settings, null, null);
+ serverGremlinExecutor = new ServerGremlinExecutor(baseSettings(), null, null);
assertThat(serverGremlinExecutor.getHooks().isEmpty(), is(true));
}
@Test
public void resolveLanguageShouldReturnExplicitLanguage() throws Exception {
- final Settings settings = readSettings("gremlin-server-minimal.yaml");
- serverGremlinExecutor = new ServerGremlinExecutor(settings, null, null);
+ serverGremlinExecutor = new ServerGremlinExecutor(baseSettings(), null, null);
final Method resolveLanguage = ServerGremlinExecutor.class.getDeclaredMethod("resolveLanguage", String.class);
resolveLanguage.setAccessible(true);
@@ -121,9 +132,7 @@ public class ServerGremlinExecutorTest {
@Test
public void resolveLanguageShouldFallBackToGremlinLangWhenNoExplicitLanguage() throws Exception {
- final Settings settings = readSettings("gremlin-server-minimal.yaml");
- // minimal YAML has no scriptEngines, so constructor default is just gremlin-lang
- serverGremlinExecutor = new ServerGremlinExecutor(settings, null, null);
+ serverGremlinExecutor = new ServerGremlinExecutor(baseSettings(), null, null);
final Method resolveLanguage = ServerGremlinExecutor.class.getDeclaredMethod("resolveLanguage", String.class);
resolveLanguage.setAccessible(true);
@@ -133,15 +142,27 @@ public class ServerGremlinExecutorTest {
}
@Test
- public void resolveLanguageShouldUseSingleNonLangEngine() throws Exception {
- final Settings settings = readSettings("gremlin-server-minimal.yaml");
+ public void resolveLanguageShouldFallBackToGremlinLangWhenMultipleEngines() throws Exception {
+ final Settings settings = baseSettings();
+ settings.scriptEngines.put("gremlin-groovy", new Settings.ScriptEngineSettings());
+ serverGremlinExecutor = new ServerGremlinExecutor(settings, null, null);
+
+ final Method resolveLanguage = ServerGremlinExecutor.class.getDeclaredMethod("resolveLanguage", String.class);
+ resolveLanguage.setAccessible(true);
+
+ assertThat(resolveLanguage.invoke(serverGremlinExecutor, (String) null), is("gremlin-lang"));
+ }
+
+ @Test
+ public void resolveLanguageShouldUseSoleConfiguredEngine() throws Exception {
+ final Settings settings = baseSettings();
+ settings.scriptEngines.clear();
settings.scriptEngines.put("gremlin-groovy", new Settings.ScriptEngineSettings());
serverGremlinExecutor = new ServerGremlinExecutor(settings, null, null);
final Method resolveLanguage = ServerGremlinExecutor.class.getDeclaredMethod("resolveLanguage", String.class);
resolveLanguage.setAccessible(true);
- // with one non-gremlin-lang engine configured, should resolve to it
assertThat(resolveLanguage.invoke(serverGremlinExecutor, (String) null), is("gremlin-groovy"));
}
}
(tinkerpop) 02/02: add airroutes server config
Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
colegreer pushed a commit to branch TINKERPOP-3107
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 4316f890baae2b772f8aa7df51f4c37ff8611f45
Author: Cole Greer <Co...@improving.com>
AuthorDate: Tue Apr 14 12:52:26 2026 -0700
add airroutes server config
---
docs/src/reference/gremlin-applications.asciidoc | 2 +-
docs/src/upgrade/release-4.x.x.asciidoc | 2 +-
gremlin-server/conf/gremlin-server-airroutes.yaml | 43 ++++++++++++++++++++++
.../server/util/TinkerFactoryDataLoader.java | 5 ++-
.../server/GremlinServerConfigIntegrateTest.java | 1 +
.../server/util/TinkerFactoryDataLoaderTest.java | 20 ++++++++++
6 files changed, 70 insertions(+), 3 deletions(-)
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index 1d0d0a0c96..573a7c4199 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -538,7 +538,7 @@ Each entry specifies:
The built-in `TinkerFactoryDataLoader` loads TinkerFactory sample datasets into a graph. It accepts two config
parameters: `graph` (the name of the graph as defined in `graphs`) and `dataset` (one of `modern`, `classic`, `crew`,
-`grateful`, or `sink`).
+`grateful`, `sink`, or `airroutes`).
Custom `LifeCycleHook` implementations must have a no-arg constructor and implement the `onStartUp(Context)` and
`onShutDown(Context)` methods. The `Context` provides access to a `Logger` and the `GraphManager`.
diff --git a/docs/src/upgrade/release-4.x.x.asciidoc b/docs/src/upgrade/release-4.x.x.asciidoc
index 6cd0fdabd4..9decb6ded9 100644
--- a/docs/src/upgrade/release-4.x.x.asciidoc
+++ b/docs/src/upgrade/release-4.x.x.asciidoc
@@ -84,7 +84,7 @@ lifecycleHooks:
Each entry specifies a `className` implementing `LifeCycleHook` and an optional `config` map passed to the hook's
`init()` method. The built-in `TinkerFactoryDataLoader` supports datasets: `modern`, `classic`, `crew`, `grateful`,
-and `sink`.
+`sink`, and `airroutes`.
===== Deprecation of Groovy Init Scripts
diff --git a/gremlin-server/conf/gremlin-server-airroutes.yaml b/gremlin-server/conf/gremlin-server-airroutes.yaml
new file mode 100644
index 0000000000..c4c4529f8f
--- /dev/null
+++ b/gremlin-server/conf/gremlin-server-airroutes.yaml
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+host: localhost
+port: 8182
+evaluationTimeout: 30000
+channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
+graphs: {
+ graph: conf/tinkergraph-empty.properties}
+lifecycleHooks:
+ - { className: org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader, config: {graph: graph, dataset: airroutes}}
+serializers:
+ - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3] }} # application/json
+ - { className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4} # application/vnd.graphbinary-v4.0
+metrics: {
+ slf4jReporter: {enabled: true, interval: 180000}}
+strictTransactionManagement: false
+idleConnectionTimeout: 0
+keepAliveInterval: 0
+maxInitialLineLength: 4096
+maxHeaderSize: 8192
+maxChunkSize: 8192
+maxRequestContentLength: 10485760
+maxAccumulationBufferComponents: 1024
+resultIterationBatchSize: 64
+writeBufferLowWaterMark: 32768
+writeBufferHighWaterMark: 65536
+ssl: {
+ enabled: false}
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoader.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoader.java
index 5cc87f8835..a211d81426 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoader.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoader.java
@@ -31,7 +31,7 @@ import java.util.Map;
* <p>Configuration parameters (via {@code config} in YAML):
* <ul>
* <li>{@code graph} — name of the graph (as defined in {@code graphs:} config) to load data into</li>
- * <li>{@code dataset} — which dataset to load: modern, classic, crew, grateful, sink</li>
+ * <li>{@code dataset} — which dataset to load: modern, classic, crew, grateful, sink, airroutes</li>
* </ul>
*
* <p>Example YAML usage:
@@ -85,6 +85,9 @@ public class TinkerFactoryDataLoader implements LifeCycleHook {
case "sink":
TinkerFactory.generateKitchenSink(tinkerGraph);
break;
+ case "airroutes":
+ TinkerFactory.generateAirRoutes(tinkerGraph);
+ break;
default:
c.getLogger().warn("TinkerFactoryDataLoader unknown dataset [{}]", dataset);
return;
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerConfigIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerConfigIntegrateTest.java
index 38e89cbddb..835aad5732 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerConfigIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerConfigIntegrateTest.java
@@ -57,6 +57,7 @@ public class GremlinServerConfigIntegrateTest {
"gremlin-server-min.yaml",
"gremlin-server-modern.yaml",
"gremlin-server-classic.yaml",
+ "gremlin-server-airroutes.yaml",
"gremlin-server-modern-readonly.yaml",
"gremlin-server-rest-modern.yaml",
"gremlin-server-transaction.yaml"
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoaderTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoaderTest.java
index 9a06fd29b5..0700c48be3 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoaderTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoaderTest.java
@@ -213,4 +213,24 @@ public class TinkerFactoryDataLoaderTest {
graph.close();
}
}
+
+ @Test
+ public void onStartUpShouldLoadAirRoutes() {
+ final TinkerFactoryDataLoader loader = new TinkerFactoryDataLoader();
+ final Map<String, Object> config = new HashMap<>();
+ config.put("graph", "graph");
+ config.put("dataset", "airroutes");
+ loader.init(config);
+
+ final TinkerGraph graph = TinkerGraph.open();
+ try {
+ final GraphManager gm = mock(GraphManager.class);
+ when(gm.getGraph("graph")).thenReturn(graph);
+
+ loader.onStartUp(createContext(gm));
+ assertThat((int) graph.traversal().V().count().next().longValue(), greaterThan(0));
+ } finally {
+ graph.close();
+ }
+ }
}