Search in sources :

Example 1 with RunSessionImpl

use of aQute.remote.plugin.RunSessionImpl in project bnd by bndtools.

the class LauncherTest method testMain.

/**
	 * Launches against main
	 */
/*
	 * 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();
}
Also used : Project(aQute.bnd.build.Project) RunSessionImpl(aQute.remote.plugin.RunSessionImpl) RemoteProjectLauncherPlugin(aQute.remote.plugin.RemoteProjectLauncherPlugin) Run(aQute.bnd.build.Run) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

Project (aQute.bnd.build.Project)1 Run (aQute.bnd.build.Run)1 RemoteProjectLauncherPlugin (aQute.remote.plugin.RemoteProjectLauncherPlugin)1 RunSessionImpl (aQute.remote.plugin.RunSessionImpl)1 CountDownLatch (java.util.concurrent.CountDownLatch)1