Search in sources :

Example 6 with GatewayServer

use of py4j.GatewayServer in project GeoGig by boundlessgeo.

the class GeogigPy4JEntryPointTest method testPy4JentryPoint.

@Test
public void testPy4JentryPoint() throws Exception {
    setupGeogig();
    setupFeatures();
    String repoFolder = platform.pwd().getAbsolutePath();
    GeogigPy4JEntryPoint py4j = new GeogigPy4JEntryPoint();
    GatewayServer gatewayServer = new GatewayServer(py4j);
    gatewayServer.start();
    py4j.runCommand(repoFolder, new String[] { "init" });
    py4j.runCommand(repoFolder, "config user.name name".split(" "));
    py4j.runCommand(repoFolder, "config user.email email@email.com".split(" "));
    insert(points1);
    insert(points2);
    insert(points3);
    geogigCLI.getGeogig().command(AddOp.class).call();
    geogigCLI.getGeogig().command(CommitOp.class).setMessage("message").call();
    py4j.runCommand(repoFolder, new String[] { "log" });
    String output = py4j.nextOutputPage();
    assertTrue(output.contains("message"));
    assertTrue(output.contains("name"));
    assertTrue(output.contains("email@email.com"));
    insert(points1_modified);
    py4j.runCommand(repoFolder, new String[] { "add" });
    py4j.runCommand(repoFolder, new String[] { "commit", "-m", "a commit message" });
    py4j.runCommand(repoFolder, new String[] { "log" });
    output = py4j.nextOutputPage();
    System.out.println(output);
    assertTrue(output.contains("a commit message"));
    gatewayServer.shutdown();
}
Also used : AddOp(org.locationtech.geogig.api.porcelain.AddOp) GeogigPy4JEntryPoint(org.locationtech.geogig.cli.GeogigPy4JEntryPoint) GatewayServer(py4j.GatewayServer) Test(org.junit.Test)

Aggregations

GatewayServer (py4j.GatewayServer)6 BufferedWriter (java.io.BufferedWriter)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 OutputStreamWriter (java.io.OutputStreamWriter)2 PipedInputStream (java.io.PipedInputStream)2 PipedOutputStream (java.io.PipedOutputStream)2 Map (java.util.Map)2 CommandLine (org.apache.commons.exec.CommandLine)2 DefaultExecutor (org.apache.commons.exec.DefaultExecutor)2 ExecuteWatchdog (org.apache.commons.exec.ExecuteWatchdog)2 PumpStreamHandler (org.apache.commons.exec.PumpStreamHandler)2 InterpreterOutputStream (org.apache.zeppelin.interpreter.util.InterpreterOutputStream)2 Path (java.nio.file.Path)1 List (java.util.List)1 Test (org.junit.Test)1 AddOp (org.locationtech.geogig.api.porcelain.AddOp)1 GeogigPy4JEntryPoint (org.locationtech.geogig.cli.GeogigPy4JEntryPoint)1