From e9801e6af60dbfbaa83a1f8b5b947451dd27092c Mon Sep 17 00:00:00 2001 From: Stephen Mallette Date: Tue, 12 Sep 2017 11:18:41 -0400 Subject: [PATCH] TINKERPOP-1779 Bump to GMavenPlus 1.6 Moved embedded groovy scripts that were in the pom to their own files. They are more manageable that way as you get some syntax highlighting/intellisense in the IDE when they have the right file extension. It also makes the pom a bit easier to follow. Removed a bunch of python test resources that were no longer in use. Centralized the scripts that start/stop Gremlin Server for GLV tests so that we don't have them copy/pasted everywhere. --- CHANGELOG.asciidoc | 1 + giraph-gremlin/pom.xml | 14 ++ gremlin-console/pom.xml | 14 ++ gremlin-dotnet/glv/generate.groovy | 220 ++++++++++++++++++ gremlin-dotnet/pom.xml | 216 +---------------- .../appsettings.json | 4 +- gremlin-dotnet/test/pom.xml | 79 +++---- gremlin-groovy-test/pom.xml | 14 ++ gremlin-groovy/pom.xml | 14 ++ .../GraphTraversalSource.template | 0 .../TraversalSource.template | 0 gremlin-python/glv/generate.groovy | 94 ++++++++ gremlin-python/pom.xml | 166 +++---------- .../gremlin/python/driver/credentials.kryo | Bin 138 -> 0 bytes .../gremlin-server-modern-secure-py.yaml | 63 ----- .../driver/tinkergraph-credentials.properties | 22 -- .../driver/tinkergraph-empty.properties | 18 -- .../tinkerpop/gremlin/server/Settings.java | 3 +- .../gremlin/server/util/MetricManager.java | 5 +- .../src/test/scripts/test-server-start.groovy | 49 ++++ .../src/test/scripts/test-server-stop.groovy | 23 +- hadoop-gremlin/pom.xml | 14 ++ pom.xml | 16 +- spark-gremlin/pom.xml | 14 ++ 24 files changed, 541 insertions(+), 522 deletions(-) create mode 100644 gremlin-dotnet/glv/generate.groovy rename gremlin-python/{src/main/resources => glv}/GraphTraversalSource.template (100%) rename gremlin-python/{src/main/resources => glv}/TraversalSource.template (100%) create mode 100644 gremlin-python/glv/generate.groovy delete mode 100644 gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/credentials.kryo delete mode 100644 gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/gremlin-server-modern-secure-py.yaml delete mode 100644 gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/tinkergraph-credentials.properties delete mode 100644 gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/tinkergraph-empty.properties create mode 100644 gremlin-server/src/test/scripts/test-server-start.groovy rename gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/generate-modern.groovy => gremlin-server/src/test/scripts/test-server-stop.groovy (60%) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index c15835c5b08..4e64fd6d0e3 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Bump to GMavenPlus 1.6. * Bump to Jackson 2.8.10. * Added an `EmbeddedRemoteConnection` so that it's possible to mimic a remote connection within the same JVM. * The Console's `plugin.txt` file is only updated if there were manually uninstalled plugins. diff --git a/giraph-gremlin/pom.xml b/giraph-gremlin/pom.xml index cacf54c2a14..f55a6a43894 100644 --- a/giraph-gremlin/pom.xml +++ b/giraph-gremlin/pom.xml @@ -227,6 +227,20 @@ limitations under the License. org.codehaus.gmavenplus gmavenplus-plugin + + + + addSources + addTestSources + generateStubs + compile + generateTestStubs + compileTests + removeStubs + removeTestStubs + + + org.apache.maven.plugins diff --git a/gremlin-console/pom.xml b/gremlin-console/pom.xml index 0531af3dd6b..50d7b0e3e03 100644 --- a/gremlin-console/pom.xml +++ b/gremlin-console/pom.xml @@ -203,6 +203,20 @@ limitations under the License. org.codehaus.gmavenplus gmavenplus-plugin + + + + addSources + addTestSources + generateStubs + compile + generateTestStubs + compileTests + removeStubs + removeTestStubs + + + diff --git a/gremlin-dotnet/glv/generate.groovy b/gremlin-dotnet/glv/generate.groovy new file mode 100644 index 00000000000..8f66c26cf5e --- /dev/null +++ b/gremlin-dotnet/glv/generate.groovy @@ -0,0 +1,220 @@ +/* + * 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. + */ + +import org.apache.tinkerpop.gremlin.jsr223.CoreImports +import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource +import org.apache.tinkerpop.gremlin.process.traversal.P +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__ +import org.apache.tinkerpop.gremlin.structure.Direction +import java.lang.reflect.Modifier + +def toCSharpTypeMap = ["Long": "long", + "Integer": "int", + "String": "string", + "Object": "object", + "java.util.Map": "IDictionary", + "java.util.Map": "IDictionary", + "java.util.List": "IList", + "java.util.Map": "IDictionary", + "java.util.Collection": "ICollection", + "java.util.Collection": "ICollection", + "java.util.Map": "IDictionary", + "TraversalMetrics": "E2"] + +def useE2 = ["E2", "E2"]; +def methodsWithSpecificTypes = ["constant": useE2, + "limit": useE2, + "mean": useE2, + "optional": useE2, + "range": useE2, + "select": ["IDictionary", "E2"], + "sum": useE2, + "tail": useE2, + "tree": ["object"], + "unfold": useE2] + +def getCSharpGenericTypeParam = { typeName -> + def tParam = "" + if (typeName.contains("E2")) { + tParam = "" + } + else if (typeName.contains("")) { + tParam = "" + } + else if (typeName.contains(" + String typeName = toCSharpTypeMap.getOrDefault(name, name); + if (typeName.equals(name) && (typeName.contains("? extends") || typeName.equals("Tree"))) { + typeName = "E2" + } + return typeName; +} + +def toCSharpMethodName = { symbol -> (String) Character.toUpperCase(symbol.charAt(0)) + symbol.substring(1) } + +def getJavaParameterTypeNames = { method -> + def typeArguments = method.genericReturnType.actualTypeArguments; + return typeArguments. + collect { (it instanceof Class) ? ((Class)it).simpleName : it.typeName }. + collect { name -> + if (name.equals("A")) { + name = "object" + } + else if (name.equals("B")) { + name = "E2"; + } + name + } +} + +def binding = ["pmethods": P.class.getMethods(). + findAll { Modifier.isStatic(it.getModifiers()) }. + findAll { P.class.isAssignableFrom(it.returnType) }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }, + "sourceStepMethods": GraphTraversalSource.getMethods(). // SOURCE STEPS + findAll { GraphTraversalSource.class.equals(it.returnType) }. + findAll { + !it.name.equals("clone") && + !it.name.equals(TraversalSource.Symbols.withBindings) && + !it.name.equals(TraversalSource.Symbols.withRemote) && + !it.name.equals(TraversalSource.Symbols.withComputer) + }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }, + "sourceSpawnMethods": GraphTraversalSource.getMethods(). // SPAWN STEPS + findAll { GraphTraversal.class.equals(it.returnType) && !it.name.equals('inject')}. + collect { [methodName: it.name, typeArguments: it.genericReturnType.actualTypeArguments.collect{t -> ((java.lang.Class)t).simpleName}] }. + unique(). + sort { a, b -> a.methodName <=> b.methodName }, + "graphStepMethods": GraphTraversal.getMethods(). + findAll { GraphTraversal.class.equals(it.returnType) }. + findAll { !it.name.equals("clone") && !it.name.equals("iterate") }. + groupBy { it.name }. + // Select unique by name, with the most amount of parameters + collect { it.value.sort { a, b -> b.parameterCount <=> a.parameterCount }.first() }. + sort { a, b -> a.name <=> b.name }. + collect { javaMethod -> + def typeNames = getJavaParameterTypeNames(javaMethod) + def t1 = toCSharpType(typeNames[0]) + def t2 = toCSharpType(typeNames[1]) + def tParam = getCSharpGenericTypeParam(t2) + return ["methodName": javaMethod.name, "t1":t1, "t2":t2, "tParam":tParam] + }, + "anonStepMethods": __.class.getMethods(). + findAll { GraphTraversal.class.equals(it.returnType) }. + findAll { Modifier.isStatic(it.getModifiers()) }. + findAll { !it.name.equals("__") && !it.name.equals("start") }. + groupBy { it.name }. + // Select unique by name, with the most amount of parameters + collect { it.value.sort { a, b -> b.parameterCount <=> a.parameterCount }.first() }. + sort { it.name }. + collect { javaMethod -> + def typeNames = getJavaParameterTypeNames(javaMethod) + def t2 = toCSharpType(typeNames[1]) + def tParam = getCSharpGenericTypeParam(t2) + def specificTypes = methodsWithSpecificTypes.get(javaMethod.name) + if (specificTypes) { + t2 = specificTypes[0] + tParam = specificTypes.size() > 1 ? "<" + specificTypes[1] + ">" : "" + } + return ["methodName": javaMethod.name, "t2":t2, "tParam":tParam] + }, + "toCSharpMethodName": toCSharpMethodName] + +def engine = new groovy.text.GStringTemplateEngine() +def traversalTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/GraphTraversal.template")).make(binding) +def traversalFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs") +traversalFile.newWriter().withWriter{ it << traversalTemplate } + +def graphTraversalTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/GraphTraversalSource.template")).make(binding) +def graphTraversalFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs") +graphTraversalFile.newWriter().withWriter{ it << graphTraversalTemplate } + +def anonymousTraversalTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/AnonymousTraversal.template")).make(binding) +def anonymousTraversalFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/__.cs") +anonymousTraversalFile.newWriter().withWriter{ it << anonymousTraversalTemplate } + +def pTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/P.template")).make(binding) +def pFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/P.cs") +pFile.newWriter().withWriter{ it << pTemplate } + +// Process enums +def toCSharpName = { enumClass, itemName -> + if (enumClass.equals(Direction.class)) { + itemName = itemName.toLowerCase() + } + + return itemName.substring(0, 1).toUpperCase() + itemName.substring(1) +} + +def createEnum = { enumClass, csharpToJava -> + def b = ["enumClass": enumClass, + "constants": enumClass.getEnumConstants(). + sort { a, b -> a.name() <=> b.name() }. + collect { value -> + def csharpName = toCSharpName(enumClass, value.name()) + csharpToJava.put(enumClass.simpleName + "." + csharpName, value.name()) + return csharpName + }.join(",\n\t\t")] + + def enumTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/Enum.template")).make(b) + def enumFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/" + enumClass.getSimpleName() + ".cs") + enumFile.newWriter().withWriter{ it << enumTemplate } +} + +def enumCSharpToJavaNames = [:] +CoreImports.getClassImports().findAll { Enum.class.isAssignableFrom(it) }. + sort { a, b -> a.getSimpleName() <=> b.getSimpleName() }. + each { createEnum(it, enumCSharpToJavaNames) } + +def lastIndex = (enumCSharpToJavaNames.size() - 1); +def body = new StringBuilder() +enumCSharpToJavaNames.eachWithIndex{ node, i -> + body.append("""{"$node.key", "$node.value"}""") + body.append(i == lastIndex ? "\n" : ",\n ") +} + +def namingConversionsTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/NamingConversions.template")).make(["body":body]) +def namingConversionsFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/NamingConversions.cs") +namingConversionsFile.newWriter().withWriter{ it << namingConversionsTemplate } + +def determineVersion = { + def env = System.getenv() + def mavenVersion = env.containsKey("TP_RELEASE_VERSION") ? env.get("DOTNET_RELEASE_VERSION") : "${projectVersion}" + + // only want to generate a timestamp for the version if this is a nuget deploy + if (!mavenVersion.endsWith("-SNAPSHOT") || null == System.getProperty("nuget")) return mavenVersion + + return mavenVersion.replace("-SNAPSHOT", "-dev-" + System.currentTimeMillis()) +} + +def versionToUse = determineVersion() +def csprojTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/Gremlin.Net.csproj.template")).make(["projectVersion":versionToUse]) +def csprojFile = new File("${projectBaseDir}/src/Gremlin.Net/Gremlin.Net.csproj") +csprojFile.newWriter().withWriter{ it << csprojTemplate } \ No newline at end of file diff --git a/gremlin-dotnet/pom.xml b/gremlin-dotnet/pom.xml index d2ab17cf270..a0ef34fb700 100644 --- a/gremlin-dotnet/pom.xml +++ b/gremlin-dotnet/pom.xml @@ -54,6 +54,7 @@ limitations under the License. org.codehaus.groovy groovy-all ${groovy.version} + indy runtime @@ -71,211 +72,18 @@ limitations under the License. execute + + + projectBaseDir + ${project.basedir} + + + projectVersion + ${project.version} + + - + diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json index 5788e506ef1..1adda9ac9bb 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json @@ -1,5 +1,5 @@ { "TestServerIpAddress": "localhost", - "TestServerPort": 45950, - "TestSecureServerPort": 45951 + "TestServerPort": 45940, + "TestSecureServerPort": 45941 } \ No newline at end of file diff --git a/gremlin-dotnet/test/pom.xml b/gremlin-dotnet/test/pom.xml index ea61c224584..7b82a2e5917 100644 --- a/gremlin-dotnet/test/pom.xml +++ b/gremlin-dotnet/test/pom.xml @@ -128,41 +128,22 @@ limitations under the License. execute + + + skipTests + ${skipTests} + + + gremlinServerDir + ${gremlin.server.dir} + + + executionName + ${project.name} + + - + @@ -173,26 +154,18 @@ log.info("Gremlin Server with authentication started on port 45951") execute + + + skipTests + ${skipTests} + + + executionName + ${project.name} + + - + diff --git a/gremlin-groovy-test/pom.xml b/gremlin-groovy-test/pom.xml index ef96f0ce542..4fa6ea52e43 100644 --- a/gremlin-groovy-test/pom.xml +++ b/gremlin-groovy-test/pom.xml @@ -50,6 +50,20 @@ limitations under the License. org.codehaus.gmavenplus gmavenplus-plugin + + + + addSources + addTestSources + generateStubs + compile + generateTestStubs + compileTests + removeStubs + removeTestStubs + + + org.apache.maven.plugins diff --git a/gremlin-groovy/pom.xml b/gremlin-groovy/pom.xml index 0a10534a162..53806abbe0f 100644 --- a/gremlin-groovy/pom.xml +++ b/gremlin-groovy/pom.xml @@ -113,6 +113,20 @@ limitations under the License. org.codehaus.gmavenplus gmavenplus-plugin + + + + addSources + addTestSources + generateStubs + compile + generateTestStubs + compileTests + removeStubs + removeTestStubs + + + org.apache.maven.plugins diff --git a/gremlin-python/src/main/resources/GraphTraversalSource.template b/gremlin-python/glv/GraphTraversalSource.template similarity index 100% rename from gremlin-python/src/main/resources/GraphTraversalSource.template rename to gremlin-python/glv/GraphTraversalSource.template diff --git a/gremlin-python/src/main/resources/TraversalSource.template b/gremlin-python/glv/TraversalSource.template similarity index 100% rename from gremlin-python/src/main/resources/TraversalSource.template rename to gremlin-python/glv/TraversalSource.template diff --git a/gremlin-python/glv/generate.groovy b/gremlin-python/glv/generate.groovy new file mode 100644 index 00000000000..4873d12ae09 --- /dev/null +++ b/gremlin-python/glv/generate.groovy @@ -0,0 +1,94 @@ +/* + * 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. + */ + +import org.apache.tinkerpop.gremlin.jsr223.CoreImports +import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource +import org.apache.tinkerpop.gremlin.process.traversal.P +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__ +import java.lang.reflect.Modifier + +// this is a bit of a copy of what's in SymbolHelper - no way around it because this code generation task occurs +// before the SymbolHelper is available to the plugin. +def toPythonMap = ["global": "global_", + "as": "as_", + "in": "in_", + "and": "and_", + "or": "or_", + "is": "is_", + "not": "not_", + "from": "from_", + "list": "list_", + "set": "set_", + "all": "all_"] +def toJavaMap = toPythonMap.collectEntries{k,v -> [(v):k]} + +def toPython = { symbol -> toPythonMap.getOrDefault(symbol, symbol) } +def toJava = { symbol -> toJavaMap.getOrDefault(symbol, symbol) } + +def binding = ["enums": CoreImports.getClassImports() + .findAll { Enum.class.isAssignableFrom(it) } + .sort { a, b -> a.getSimpleName() <=> b.getSimpleName() }, + "pmethods": P.class.getMethods(). + findAll { Modifier.isStatic(it.getModifiers()) }. + findAll { P.class.isAssignableFrom(it.returnType) }. + collect { toPython(it.name) }. + unique(). + sort { a, b -> a <=> b }, + "sourceStepMethods": GraphTraversalSource.getMethods(). // SOURCE STEPS + findAll { GraphTraversalSource.class.equals(it.returnType) }. + findAll { + !it.name.equals("clone") && + !it.name.equals(TraversalSource.Symbols.withBindings) && + !it.name.equals(TraversalSource.Symbols.withRemote) && + !it.name.equals(TraversalSource.Symbols.withComputer) + }. + collect { toPython(it.name) }. + unique(). + sort { a, b -> a <=> b }, + "sourceSpawnMethods": GraphTraversalSource.getMethods(). // SPAWN STEPS + findAll { GraphTraversal.class.equals(it.returnType) }. + collect { toPython(it.name) }. + unique(). + sort { a, b -> a <=> b }, + "graphStepMethods": GraphTraversal.getMethods(). + findAll { GraphTraversal.class.equals(it.returnType) }. + findAll { !it.name.equals("clone") && !it.name.equals("iterate") }. + collect { toPython(it.name) }. + unique(). + sort { a, b -> a <=> b }, + "anonStepMethods": __.class.getMethods(). + findAll { GraphTraversal.class.equals(it.returnType) }. + findAll { Modifier.isStatic(it.getModifiers()) }. + findAll { !it.name.equals("__") && !it.name.equals("start") }. + collect { toPython(it.name) }. + unique(). + sort { a, b -> a <=> b }, + "toPython": toPython, + "toJava": toJava] + +def engine = new groovy.text.GStringTemplateEngine() +def traversalTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/TraversalSource.template")).make(binding) +def traversalFile = new File("${projectBaseDir}/src/main/jython/gremlin_python/process/traversal.py") +traversalFile.newWriter().withWriter{ it << traversalTemplate } + +def graphTraversalTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/GraphTraversalSource.template")).make(binding) +def graphTraversalFile = new File("${projectBaseDir}/src/main/jython/gremlin_python/process/graph_traversal.py") +graphTraversalFile.newWriter().withWriter{ it << graphTraversalTemplate } \ No newline at end of file diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml index 1b703255851..b60b8671a58 100644 --- a/gremlin-python/pom.xml +++ b/gremlin-python/pom.xml @@ -467,7 +467,8 @@ limitations under the License. org.codehaus.groovy groovy-all - ${groovy.version} + 2.4.11 + indy runtime @@ -485,84 +486,14 @@ limitations under the License. execute + + + projectBaseDir + ${project.basedir} + + - + @@ -573,41 +504,22 @@ graphTraversalFile.newWriter().withWriter{ it << graphTraversalTemplate } execute + + + skipTests + ${skipTests} + + + gremlinServerDir + ${gremlin.server.dir} + + + executionName + ${project.name} + + - + @@ -618,26 +530,18 @@ log.info("Gremlin Server with authentication started on port 45941") execute + + + skipTests + ${skipTests} + + + executionName + ${project.name} + + - + diff --git a/gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/credentials.kryo b/gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/credentials.kryo deleted file mode 100644 index 163d2ef49d7eca31a823e8e953f33a3e71d3d7ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 138 zcmYe#%x6Fbj13G7oD7Vm#i^ed7#LX?3lfWq%kzt#FmbXlGpZORsu&umVBw09> zmw0Dql%JXr=^s+yZh$)Ww;e&R=Vnk2B&8gdK7wPoCg_Ml$V(M dl!=pxnX$MewICz)9X}%@r n.endsWith("long-run-compilation-count"))) { final GremlinGroovyScriptEngine gremlinGroovyScriptEngine = (GremlinGroovyScriptEngine) engine; getRegistry().register( MetricRegistry.name(GremlinServer.class, ArrayUtils.add(prefix, "long-run-compilation-count")), diff --git a/gremlin-server/src/test/scripts/test-server-start.groovy b/gremlin-server/src/test/scripts/test-server-start.groovy new file mode 100644 index 00000000000..83efcd59cc8 --- /dev/null +++ b/gremlin-server/src/test/scripts/test-server-start.groovy @@ -0,0 +1,49 @@ +/* + * 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. + */ + +import org.apache.tinkerpop.gremlin.server.GremlinServer +import org.apache.tinkerpop.gremlin.server.Settings +import org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator + +if (Boolean.parseBoolean(skipTests)) return + +log.info("Starting Gremlin Server instances for native testing of ${executionName}") +def settings = Settings.read("${gremlinServerDir}/conf/gremlin-server-modern-py.yaml") +settings.graphs.graph = gremlinServerDir + "/conf/tinkergraph-empty.properties" +settings.scriptEngines["gremlin-groovy"].scripts = [gremlinServerDir + "/scripts/generate-modern.groovy"] +settings.port = 45940 + +def server = new GremlinServer(settings) +server.start().join() + +project.setContextValue("gremlin.server", server) +log.info("Gremlin Server with no authentication started on port 45940") + +def settingsSecure = Settings.read("${gremlinServerDir}/conf/gremlin-server-modern.yaml") +settingsSecure.graphs.graph = gremlinServerDir + "/conf/tinkergraph-empty.properties" +settingsSecure.scriptEngines["gremlin-groovy"].scripts = [gremlinServerDir + "/scripts/generate-modern.groovy"] +settingsSecure.port = 45941 +settingsSecure.authentication.className = SimpleAuthenticator.class.name +settingsSecure.authentication.config = [credentialsDb: gremlinServerDir + "/conf/tinkergraph-credentials.properties", credentialsDbLocation: gremlinServerDir + "/data/credentials.kryo"] + +def serverSecure = new GremlinServer(settingsSecure) +serverSecure.start().join() + +project.setContextValue("gremlin.server.secure", serverSecure) +log.info("Gremlin Server with authentication started on port 45941") \ No newline at end of file diff --git a/gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/generate-modern.groovy b/gremlin-server/src/test/scripts/test-server-stop.groovy similarity index 60% rename from gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/generate-modern.groovy rename to gremlin-server/src/test/scripts/test-server-stop.groovy index 23b4a6150a3..595d9bd9da3 100644 --- a/gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/generate-modern.groovy +++ b/gremlin-server/src/test/scripts/test-server-stop.groovy @@ -17,17 +17,16 @@ * under the License. */ -// an init script that returns a Map allows explicit setting of global bindings. -def globals = [:] +if (Boolean.parseBoolean(skipTests)) return -// Generates the modern graph into an "empty" TinkerGraph via LifeCycleHook. -// Note that the name of the key in the "global" map is unimportant. -globals << [hook : [ - onStartUp: { ctx -> - ctx.logger.info("Loading 'modern' graph data.") - TinkerFactory.generateModern(graph) - } -] as LifeCycleHook] +log.info("Tests for native ${executionName} complete") -// define the default TraversalSource to bind queries to - this one will be named "g". -globals << [g : graph.traversal()] \ No newline at end of file +def server = project.getContextValue("gremlin.server") +log.info("Shutting down $server") +server.stop().join() + +def serverSecure = project.getContextValue("gremlin.server.secure") +log.info("Shutting down $serverSecure") +serverSecure.stop().join() + +log.info("All Gremlin Server instances are shutdown for ${executionName}") \ No newline at end of file diff --git a/hadoop-gremlin/pom.xml b/hadoop-gremlin/pom.xml index f002e3f2360..3ed26d421e3 100644 --- a/hadoop-gremlin/pom.xml +++ b/hadoop-gremlin/pom.xml @@ -221,6 +221,20 @@ limitations under the License. org.codehaus.gmavenplus gmavenplus-plugin + + + + addSources + addTestSources + generateStubs + compile + generateTestStubs + compileTests + removeStubs + removeTestStubs + + + diff --git a/pom.xml b/pom.xml index 57d12620b67..867aaf4749a 100644 --- a/pom.xml +++ b/pom.xml @@ -462,21 +462,7 @@ limitations under the License. org.codehaus.gmavenplus gmavenplus-plugin - 1.5 - - - - addSources - addTestSources - generateStubs - compile - testGenerateStubs - testCompile - removeStubs - removeTestStubs - - - + 1.6 1.8 true diff --git a/spark-gremlin/pom.xml b/spark-gremlin/pom.xml index dc3c0eaee9a..560e236e104 100644 --- a/spark-gremlin/pom.xml +++ b/spark-gremlin/pom.xml @@ -361,6 +361,20 @@ org.codehaus.gmavenplus gmavenplus-plugin + + + + addSources + addTestSources + generateStubs + compile + generateTestStubs + compileTests + removeStubs + removeTestStubs + + + org.apache.maven.plugins