use of aQute.bnd.build.ProjectLauncher in project bnd by bndtools.
the class LauncherTest method testShaPackager.
/**
* Test the sha packager
*
* @throws Exception
*/
public static void testShaPackager() throws Exception {
Project project = getProject();
project.clear();
project.setProperty("-package", "jpm");
ProjectLauncher l = project.getProjectLauncher();
l.setTrace(true);
Jar executable = l.executable();
assertNotNull(executable);
Manifest m = executable.getManifest();
m.write(System.out);
System.out.flush();
assertNotNull(m.getMainAttributes().getValue("JPM-Classpath"));
assertNotNull(m.getMainAttributes().getValue("JPM-Runbundles"));
Resource r = executable.getResource("launcher.properties");
assertNotNull(r);
Properties p = new Properties();
try (InputStream in = r.openInputStream()) {
p.load(in);
}
System.out.println(p);
String s = p.getProperty("launch.bundles");
assertTrue(s.contains("${JPMREPO}/"));
assertEquals("false", p.getProperty("launch.embedded"));
}
use of aQute.bnd.build.ProjectLauncher in project bnd by bndtools.
the class LauncherTest method testPackager.
/**
* Test the packager
*
* @throws Exception
*/
public static void testPackager() throws Exception {
Project project = getProject();
project.clear();
project.setProperty("[debug]testprop", "debug");
project.setProperty("[exec]testprop", "exec");
project.setProperty("Header", "${testprop}");
project.setProperty(Constants.PROFILE, "exec");
ProjectLauncher l = project.getProjectLauncher();
l.setTrace(true);
Jar executable = l.executable();
assertNotNull(executable);
assertEquals("exec", project.getProperty("testprop"));
assertEquals("exec", project.getProperty("Header"));
}
use of aQute.bnd.build.ProjectLauncher in project bnd by bndtools.
the class LauncherTest method testRunKeep.
// public static void testLocalLaunch() throws Exception {
// Project project = getProject();
// ProjectLauncher l = project.getProjectLauncher();
// l.setTrace(true);
// l.getRunProperties().put("test.cmd", "exit");
// //assertTrue(project.check());
// assertEquals(42, l.start(null));
// }
/**
* Test if we can keep the framework state.
*/
public static void testRunKeep() throws Exception {
//
// First set persistence after clearing the storage
//
Project project = getProject();
project.setProperty("-runkeep", "false");
ProjectLauncher l = project.getProjectLauncher();
l.setTrace(true);
l.getRunProperties().put("test.cmd", "setpersistence");
assertEquals(55, l.launch());
//
// Check that we really clear by clearing and checking state
// this must fail with -2
//
project = getProject();
project.setProperty("-runkeep", "false");
l = project.getProjectLauncher();
l.setTrace(true);
l.getRunProperties().put("test.cmd", "getpersistence");
assertEquals(-2, l.launch());
//
// We now try to set the state again with a cleared framework
//
project = getProject();
project.setProperty("-runkeep", "false");
l = project.getProjectLauncher();
l.setTrace(true);
l.getRunProperties().put("test.cmd", "setpersistence");
assertEquals(55, l.launch());
//
// And now it should have been saved if we do not clear
// the framework
//
project = getProject();
project.setProperty("-runkeep", "true");
l = project.getProjectLauncher();
l.setTrace(true);
l.getRunProperties().put("test.cmd", "getpersistence");
assertEquals(65, l.launch());
}
use of aQute.bnd.build.ProjectLauncher in project bnd by bndtools.
the class LauncherTest method testSimple.
public static void testSimple() throws Exception {
Project project = getProject();
ProjectLauncher l = project.getProjectLauncher();
l.setTrace(true);
l.getRunProperties().put("test.cmd", "exit");
// assertTrue(project.check());
assertEquals(42, l.launch());
}
use of aQute.bnd.build.ProjectLauncher in project bnd by bndtools.
the class ProjectTesterImpl method prepare.
@Override
public boolean prepare() throws Exception {
if (!prepared) {
prepared = true;
super.prepare();
ProjectLauncher launcher = getProjectLauncher();
if (port > 0) {
launcher.getRunProperties().put(TESTER_PORT, "" + port);
if (host != null)
launcher.getRunProperties().put(TESTER_HOST, "" + host);
}
launcher.getRunProperties().put(TESTER_UNRESOLVED, getProject().getProperty(Constants.TESTUNRESOLVED, "true"));
launcher.getRunProperties().put(TESTER_DIR, getReportDir().getAbsolutePath());
launcher.getRunProperties().put(TESTER_CONTINUOUS, "" + getContinuous());
if (getProject().is(Constants.RUNTRACE))
launcher.getRunProperties().put(TESTER_TRACE, "true");
Collection<String> testnames = getTests();
if (testnames.size() > 0) {
launcher.getRunProperties().put(TESTER_NAMES, Processor.join(testnames));
}
// This is only necessary because we might be picked
// as default and that implies we're not on the -testpath
launcher.addDefault(Constants.DEFAULT_TESTER_BSN);
launcher.prepare();
}
return true;
}
Aggregations