@Test
  public void testPy4JentryPoint() throws Exception {
    setupGeogig();
    setupFeatures();
    String repoFolder = platform.pwd().getAbsolutePath();
    GeogigPy4JEntryPoint py4j = new GeogigPy4JEntryPoint(true);
    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 protected]".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("*****@*****.**"));
    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();
  }
Beispiel #2
0
 /** @param args */
 public static void main(String[] args) {
   GatewayServer.turnLoggingOff();
   //		Logger logger = Logger.getLogger("py4j");
   //		logger.setLevel(Level.ALL);
   GatewayServer server = new GatewayServer(new ExampleEntryPoint());
   server.start();
   //		try {
   //			Thread.sleep(10000);
   //		} catch (Exception e) {
   //			e.printStackTrace();
   //		}
   //		server.stop();
 }
Beispiel #3
0
  public static void main(String[] args) {
    //		GatewayServer.turnAllLoggingOn();
    Logger logger = Logger.getLogger("py4j");
    logger.setLevel(Level.ALL);
    ConsoleHandler handler = new ConsoleHandler();
    handler.setLevel(Level.FINEST);
    logger.addHandler(handler);
    System.out.println("Starting");

    SharedRunnable sharedRunnable = new SharedRunnable();
    Thread thread = new Thread(sharedRunnable, "SharedRunnable");
    thread.setDaemon(true);
    thread.start();

    EntryPoint entryPoint0 = new EntryPoint(0, sharedRunnable);
    ClientServer clientServer0 = new ClientServer(entryPoint0);
    // Wait for Python side to shut down Java side
    clientServer0.startServer(true);

    // TODO: Refactor with Py4J Pull 204
    // Start the second client server on default + 10 port, the rest of the
    // arguments are the same
    EntryPoint entryPoint1 = new EntryPoint(1, sharedRunnable);
    ClientServer clientServer1 =
        new ClientServer(
            GatewayServer.DEFAULT_PORT + 2,
            GatewayServer.defaultAddress(),
            GatewayServer.DEFAULT_PYTHON_PORT + 2,
            GatewayServer.defaultAddress(),
            GatewayServer.DEFAULT_CONNECT_TIMEOUT,
            GatewayServer.DEFAULT_READ_TIMEOUT,
            ServerSocketFactory.getDefault(),
            SocketFactory.getDefault(),
            entryPoint1);
    // Wait for Python side to shut down Java side
    clientServer1.startServer(true);

    // Shut down after 5 seconds
    // clientServer.startServer(true);
    // try {
    // Thread.currentThread().sleep(5000);
    // } catch (Exception e) {
    // e.printStackTrace();
    // }
    // clientServer.shutdown();
    //
    // System.out.println("Stopping");
  }
Beispiel #4
0
 public static void main(String[] args) {
   Interface intrface = new Interface();
   // app is now the gateway.entry_point
   GatewayServer server = new GatewayServer(intrface, 9009);
   server.start();
 }