Skip to content

Commit 919ac22

Browse files
committed
add airroutes server config
1 parent ff9a18a commit 919ac22

6 files changed

Lines changed: 70 additions & 3 deletions

File tree

docs/src/reference/gremlin-applications.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ Each entry specifies:
538538
539539
The built-in `TinkerFactoryDataLoader` loads TinkerFactory sample datasets into a graph. It accepts two config
540540
parameters: `graph` (the name of the graph as defined in `graphs`) and `dataset` (one of `modern`, `classic`, `crew`,
541-
`grateful`, or `sink`).
541+
`grateful`, `sink`, or `airroutes`).
542542
543543
Custom `LifeCycleHook` implementations must have a no-arg constructor and implement the `onStartUp(Context)` and
544544
`onShutDown(Context)` methods. The `Context` provides access to a `Logger` and the `GraphManager`.

docs/src/upgrade/release-4.x.x.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ lifecycleHooks:
103103
104104
Each entry specifies a `className` implementing `LifeCycleHook` and an optional `config` map passed to the hook's
105105
`init()` method. The built-in `TinkerFactoryDataLoader` supports datasets: `modern`, `classic`, `crew`, `grateful`,
106-
and `sink`.
106+
`sink`, and `airroutes`.
107107
108108
===== Deprecation of Groovy Init Scripts
109109
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
host: localhost
19+
port: 8182
20+
evaluationTimeout: 30000
21+
channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
22+
graphs: {
23+
graph: conf/tinkergraph-empty.properties}
24+
lifecycleHooks:
25+
- { className: org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader, config: {graph: graph, dataset: airroutes}}
26+
serializers:
27+
- { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3] }} # application/json
28+
- { className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4} # application/vnd.graphbinary-v4.0
29+
metrics: {
30+
slf4jReporter: {enabled: true, interval: 180000}}
31+
strictTransactionManagement: false
32+
idleConnectionTimeout: 0
33+
keepAliveInterval: 0
34+
maxInitialLineLength: 4096
35+
maxHeaderSize: 8192
36+
maxChunkSize: 8192
37+
maxRequestContentLength: 10485760
38+
maxAccumulationBufferComponents: 1024
39+
resultIterationBatchSize: 64
40+
writeBufferLowWaterMark: 32768
41+
writeBufferHighWaterMark: 65536
42+
ssl: {
43+
enabled: false}

gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoader.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* <p>Configuration parameters (via {@code config} in YAML):
3232
* <ul>
3333
* <li>{@code graph} — name of the graph (as defined in {@code graphs:} config) to load data into</li>
34-
* <li>{@code dataset} — which dataset to load: modern, classic, crew, grateful, sink</li>
34+
* <li>{@code dataset} — which dataset to load: modern, classic, crew, grateful, sink, airroutes</li>
3535
* </ul>
3636
*
3737
* <p>Example YAML usage:
@@ -85,6 +85,9 @@ public void onStartUp(final Context c) {
8585
case "sink":
8686
TinkerFactory.generateKitchenSink(tinkerGraph);
8787
break;
88+
case "airroutes":
89+
TinkerFactory.generateAirRoutes(tinkerGraph);
90+
break;
8891
default:
8992
c.getLogger().warn("TinkerFactoryDataLoader unknown dataset [{}]", dataset);
9093
return;

gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerConfigIntegrateTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public static Collection<String> configs() {
5757
"gremlin-server-min.yaml",
5858
"gremlin-server-modern.yaml",
5959
"gremlin-server-classic.yaml",
60+
"gremlin-server-airroutes.yaml",
6061
"gremlin-server-modern-readonly.yaml",
6162
"gremlin-server-rest-modern.yaml",
6263
"gremlin-server-transaction.yaml"

gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/util/TinkerFactoryDataLoaderTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,24 @@ public void onStartUpShouldLoadSink() {
213213
graph.close();
214214
}
215215
}
216+
217+
@Test
218+
public void onStartUpShouldLoadAirRoutes() {
219+
final TinkerFactoryDataLoader loader = new TinkerFactoryDataLoader();
220+
final Map<String, Object> config = new HashMap<>();
221+
config.put("graph", "graph");
222+
config.put("dataset", "airroutes");
223+
loader.init(config);
224+
225+
final TinkerGraph graph = TinkerGraph.open();
226+
try {
227+
final GraphManager gm = mock(GraphManager.class);
228+
when(gm.getGraph("graph")).thenReturn(graph);
229+
230+
loader.onStartUp(createContext(gm));
231+
assertThat((int) graph.traversal().V().count().next().longValue(), greaterThan(0));
232+
} finally {
233+
graph.close();
234+
}
235+
}
216236
}

0 commit comments

Comments
 (0)