Use local copy of latest bndlib code for pre-release testing purposes
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1347815 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/ProjectTester.java b/bundleplugin/src/main/java/aQute/bnd/build/ProjectTester.java
new file mode 100644
index 0000000..5060d2f
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/bnd/build/ProjectTester.java
@@ -0,0 +1,75 @@
+package aQute.bnd.build;
+
+import java.io.*;
+import java.util.*;
+
+public abstract class ProjectTester {
+ final Project project;
+ final Collection<Container> testbundles;
+ final ProjectLauncher launcher;
+ final List<String> tests = new ArrayList<String>();
+ File reportDir;
+ boolean continuous = true;
+
+ public ProjectTester(Project project) throws Exception {
+ this.project = project;
+ launcher = project.getProjectLauncher();
+ testbundles = project.getTestpath();
+ 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<String> getTests() {
+ return tests;
+ }
+
+ public Collection<File> getReports() {
+ List<File> reports = new ArrayList<File>();
+ 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 boolean prepare() throws Exception {
+ reportDir.mkdirs();
+ for ( File file : reportDir.listFiles() ) {
+ file.delete();
+ }
+ return true;
+ }
+
+ public abstract int test() throws Exception;
+}