aQute.bnd.build.ProjectTester Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bnd Show documentation
Show all versions of bnd Show documentation
A command line utility and Ant plugin to wrap, build, or examine bundles.
package aQute.bnd.build;
import java.io.*;
import java.util.*;
import aQute.bnd.osgi.*;
public abstract class ProjectTester {
final Project project;
final Collection testbundles;
final ProjectLauncher launcher;
final List tests = new ArrayList();
File reportDir;
boolean continuous = true;
File cwd;
public ProjectTester(Project project) throws Exception {
this.project = project;
launcher = project.getProjectLauncher();
launcher.addRunVM("-ea");
testbundles = project.getTestpath();
continuous = project.is(Constants.TESTCONTINUOUS);
for (Container c : testbundles) {
launcher.addClasspath(c);
}
reportDir = new File(project.getTarget(), project.getProperty("test-reports", "test-reports"));
}
public ProjectLauncher getProjectLauncher() {
return launcher;
}
public void addTest(String test) {
tests.add(test);
}
public Collection getTests() {
return tests;
}
public Collection getReports() {
List reports = new ArrayList();
for (File report : reportDir.listFiles()) {
if (report.isFile())
reports.add(report);
}
return reports;
}
public File getReportDir() {
return reportDir;
}
public void setReportDir(File reportDir) {
this.reportDir = reportDir;
}
public Project getProject() {
return project;
}
public boolean getContinuous() {
return continuous;
}
public void setContinuous(boolean b) {
this.continuous = b;
}
public File getCwd() {
return cwd;
}
public void setCwd(File dir) {
this.cwd = dir;
}
public boolean prepare() throws Exception {
if (!reportDir.exists() && !reportDir.mkdirs()) {
throw new IOException("Could not create directory " + reportDir);
}
for (File file : reportDir.listFiles()) {
file.delete();
}
return true;
}
public abstract int test() throws Exception;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy