Example #1
0
  /*
   * Launches against the agent& main
   */
  public void testMain() throws Exception {
    Project project = workspace.getProject("p1");
    Run bndrun = new Run(workspace, project.getBase(), project.getFile("one.bndrun"));
    bndrun.setProperty("-runpath", "biz.aQute.remote.launcher");
    bndrun.setProperty("-runbundles", "bsn-1,bsn-2");
    bndrun.setProperty("-runremote", "main;agent=1090");

    final RemoteProjectLauncherPlugin pl =
        (RemoteProjectLauncherPlugin) bndrun.getProjectLauncher();
    pl.prepare();

    List<? extends RunSession> sessions = pl.getRunSessions();
    assertEquals(1, sessions.size());

    RunSessionImpl main = (RunSessionImpl) sessions.get(0);

    CountDownLatch mainLatch = launch(main);

    main.waitTillStarted(1000);

    assertEquals(0, main.started.getCount());
    Thread.sleep(500);

    main.cancel();

    mainLatch.await();
    assertEquals(-3, main.getExitCode());

    bndrun.close();
  }