You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/08/28 22:47:20 UTC

[3/3] tinkerpop git commit: Add start/stop of Gremlin Server to python integration tests - Dope! CTR

Add start/stop of Gremlin Server to python integration tests - Dope! CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/886bb56f
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/886bb56f
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/886bb56f

Branch: refs/heads/master
Commit: 886bb56fc68dedb45b6e5323edd5b91b379708f2
Parents: c8e6511
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sun Aug 28 16:15:03 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Sun Aug 28 16:15:03 2016 -0400

----------------------------------------------------------------------
 gremlin-python/pom.xml                        | 85 ++++++++++++++++++++++
 gremlin-server/scripts/generate-modern.groovy |  2 +-
 2 files changed, 86 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/886bb56f/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index a03cdbb..7c12999 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -247,6 +247,7 @@
                 </property>
             </activation>
             <build>
+
                 <!-- don't exclude any tests as python is assumed to be installed on this system -->
                 <plugins>
                     <plugin>
@@ -370,6 +371,90 @@
                             </execution>
                         </executions>
                     </plugin>
+                    <plugin>
+                        <groupId>org.codehaus.gmavenplus</groupId>
+                        <artifactId>gmavenplus-plugin</artifactId>
+                        <version>1.2</version>
+                        <dependencies>
+                            <dependency>
+                                <groupId>org.codehaus.groovy</groupId>
+                                <artifactId>groovy-all</artifactId>
+                                <version>${groovy.version}</version>
+                                <scope>runtime</scope>
+                            </dependency>
+                            <dependency>
+                                <groupId>log4j</groupId>
+                                <artifactId>log4j</artifactId>
+                                <version>1.2.17</version>
+                                <scope>runtime</scope>
+                            </dependency>
+                        </dependencies>
+                        <executions>
+                            <execution>
+                                <id>gremlin-server-start</id>
+                                <phase>pre-integration-test</phase>
+                                <goals>
+                                    <goal>execute</goal>
+                                </goals>
+                                <configuration>
+                                    <scripts>
+                                        <script>
+                                            <![CDATA[
+import org.apache.tinkerpop.gremlin.server.GremlinServer
+import org.apache.tinkerpop.gremlin.server.Settings
+import org.apache.tinkerpop.gremlin.server.Settings.ScriptEngineSettings
+
+log.info("Starting Gremlin Server instances for native testing of gremlin-python")
+def settings = Settings.read("${project.parent.basedir}/gremlin-server/conf/gremlin-server-modern-py.yaml")
+settings.graphs.graph = "${project.parent.basedir}/gremlin-server/conf/tinkergraph-empty.properties"
+settings.scriptEngines["gremlin-groovy"].scripts = ["${project.parent.basedir}/gremlin-server/scripts/generate-modern.groovy"]
+
+def server = new GremlinServer(settings)
+server.start().join()
+
+project.setContextValue("gremlin.py.server", server)
+log.info("Gremlin Server with no authentication started on port 8182")
+
+def settingsSecure = Settings.read("${project.parent.basedir}/gremlin-server/conf/gremlin-server-modern-py.yaml")
+settingsSecure.graphs.graph = "${project.parent.basedir}/gremlin-server/conf/tinkergraph-empty.properties"
+settingsSecure.scriptEngines["gremlin-groovy"].scripts = ["${project.parent.basedir}/gremlin-server/scripts/generate-modern.groovy"]
+settingsSecure.port = 8183
+settingsSecure.authentication.className = "org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator"
+settingsSecure.authentication.config = [credentialsDb: "${project.parent.basedir}/gremlin-server/conf/tinkergraph-credentials.properties"]
+
+def serverSecure = new GremlinServer(settingsSecure)
+serverSecure.start().join()
+
+project.setContextValue("gremlin.py.server.secure", serverSecure)
+log.info("Gremlin Server with authentication started on port 8183")
+]]>
+                                        </script>
+                                    </scripts>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>gremlin-server-stop</id>
+                                <phase>post-integration-test</phase>
+                                <goals>
+                                    <goal>execute</goal>
+                                </goals>
+                                <configuration>
+                                    <scripts>
+                                        <script>
+                                            <![CDATA[
+import org.apache.tinkerpop.gremlin.server.GremlinServer
+
+log.info("Tests for native gremlin-python complete - shutting down Gremlin Server")
+project.getContextValue("gremlin.py.server").stop().join()
+project.getContextValue("gremlin.py.server.secure").stop().join()
+log.info("Gremlin Server shutdown")
+]]>
+                                        </script>
+                                    </scripts>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
                 </plugins>
             </build>
         </profile>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/886bb56f/gremlin-server/scripts/generate-modern.groovy
----------------------------------------------------------------------
diff --git a/gremlin-server/scripts/generate-modern.groovy b/gremlin-server/scripts/generate-modern.groovy
index 23b4a61..e254cd4 100644
--- a/gremlin-server/scripts/generate-modern.groovy
+++ b/gremlin-server/scripts/generate-modern.groovy
@@ -25,7 +25,7 @@ def globals = [:]
 globals << [hook : [
   onStartUp: { ctx ->
     ctx.logger.info("Loading 'modern' graph data.")
-    TinkerFactory.generateModern(graph)
+      org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory.generateModern(graph)
   }
 ] as LifeCycleHook]