Ejemplo n.º 1
0
  @Test
  @Ignore // ignored to not run this automatically.
  // Run this for manual testing in its own JUnit process (right-click in IDE),
  // and simultaneously run testStartListener in a separate JUnit process...
  public void testStartClientAndSubmitCallable() {
    final MobilityController mobilityController = MobilityRPC.newController();

    MobilitySession session = mobilityController.getSession(UUID.randomUUID());

    logger.log(Level.INFO, "Created session: " + session);
    final int numOne = 5;
    final int numTwo = 6;

    Integer result =
        session.execute(
            new ConnectionId("127.0.0.1", 5739),
            ExecutionMode.RETURN_RESPONSE,
            new Callable<Integer>() {
              @Override
              public Integer call() {
                return (numOne + numTwo) * 1000;
              }
            });
    logger.log(Level.INFO, "Result returned by callable: " + result);
  }
Ejemplo n.º 2
0
  @Test
  @Ignore // ignored to not run this automatically.
  // Run this for manual testing in its own JUnit process (right-click in IDE),
  // and simultaneously run testStartListener in a separate JUnit process...
  public void testStartClientAndSubmitRunnable() {
    final MobilityController mobilityController = MobilityRPC.newController();

    MobilitySession session =
        mobilityController.getSession(UUID.fromString("1dc91c11-79f3-47fe-a77f-37277c73a929"));

    logger.log(Level.INFO, "Created session: " + session);

    session.execute(
        new ConnectionId("127.0.0.1", 5739),
        ExecutionMode.RETURN_RESPONSE,
        new Runnable() {
          @Override
          public void run() {
            System.out.println("Hello World");
          }
        });
  }
Ejemplo n.º 3
0
  @Test
  @Ignore // ignored to not run this automatically.
  // Run this for manual testing in its own JUnit process (right-click in IDE),
  // and simultaneously run testStartListener in a separate JUnit process...
  public void testStartClientAndSubmitRunnable_External() {
    final MobilityController mobilityController = MobilityRPC.newController();

    //        MobilitySession session =
    // mobilityController.getSession(UUID.fromString("1dc91c11-79f3-47fe-a77f-37277c73a929"));
    MobilitySession session = mobilityController.getSession(UUID.randomUUID());

    logger.log(Level.INFO, "Created session: " + session);

    session.execute(
        new ConnectionId("192.168.56.101", 5739),
        ExecutionMode.RETURN_RESPONSE,
        new Runnable() {
          @Override
          public void run() {
            System.out.println("Hello World !! ");
            JFrame window = new JFrame("Hello Remote World");
            window.setSize(600, 400);
            JLabel label =
                new JLabel(
                    "<html><center><font size=+6><b>This is a test</b></font></center></html>");
            window.getContentPane().setLayout(new BorderLayout());
            window.getContentPane().add(label, BorderLayout.CENTER);
            label.setHorizontalAlignment(SwingConstants.CENTER);
            window.setLocationRelativeTo(null);
            window.setVisible(true);
            window.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            try {
              Thread.sleep(10000);
            } catch (InterruptedException ignore) {
            }
            window.dispose();
          }
        });
  }