Skip to content
Browse files

Drop ForkTestDefinition in favor of TaskDef

  • Loading branch information...
1 parent ba28e5b commit 301c11f9e02d01114a0685cedeb20df8be68293d @harrah harrah committed
View
2 main/actions/src/main/scala/sbt/ForkTests.scala
@@ -61,7 +61,7 @@ private[sbt] object ForkTests {
os.writeBoolean(log.ansiCodesSupported)
val testsFiltered = tests.filter(test => filters.forall(_(test.name))).map{
- t => new ForkTestDefinition(t.name, t.fingerprint, t.explicitlySpecified, t.selectors)
+ t => new TaskDef(t.name, t.fingerprint, t.explicitlySpecified, t.selectors)
}.toArray
os.writeObject(testsFiltered)
View
28 testing/agent/src/main/java/sbt/ForkMain.java
@@ -39,26 +39,6 @@
public boolean isModule() { return isModule; }
public String annotationName() { return annotationName; }
}
- public static class ForkTestDefinition implements Serializable {
- public String name;
- public Fingerprint fingerprint;
- public boolean explicitlySpecified;
- public Selector[] selectors;
-
- public ForkTestDefinition(String name, Fingerprint fingerprint, boolean explicitlySpecified, Selector[] selectors) {
- this.name = name;
- if (fingerprint instanceof SubclassFingerprint) {
- this.fingerprint = new SubclassFingerscan((SubclassFingerprint) fingerprint);
- } else {
- this.fingerprint = new AnnotatedFingerscan((AnnotatedFingerprint) fingerprint);
- }
- this.explicitlySpecified = explicitlySpecified;
- int length = selectors.length;
- this.selectors = new Selector[length];
- for (int i = 0; i < length; i++)
- this.selectors[i] = forkSelector(selectors[i]);
- }
- }
static class ForkError extends Exception {
private String originalMessage;
private ForkError cause;
@@ -158,7 +138,7 @@ void writeEvents(ObjectOutputStream os, TaskDef taskDef, ForkEvent[] events) {
}
void runTests(ObjectInputStream is, final ObjectOutputStream os) throws Exception {
final boolean ansiCodesSupported = is.readBoolean();
- final ForkTestDefinition[] tests = (ForkTestDefinition[]) is.readObject();
+ final TaskDef[] tests = (TaskDef[]) is.readObject();
int nFrameworks = is.readInt();
Logger[] loggers = {
new Logger() {
@@ -195,10 +175,10 @@ void runTests(ObjectInputStream is, final ObjectOutputStream os) throws Exceptio
ArrayList<TaskDef> filteredTests = new ArrayList<TaskDef>();
for (Fingerprint testFingerprint : framework.fingerprints()) {
- for (ForkTestDefinition test : tests) {
+ for (TaskDef test : tests) {
// TODO: To pass in correct explicitlySpecified and selectors
- if (matches(testFingerprint, test.fingerprint))
- filteredTests.add(new TaskDef(test.name, test.fingerprint, test.explicitlySpecified, test.selectors));
+ if (matches(testFingerprint, test.fingerprint()))
+ filteredTests.add(new TaskDef(test.fullyQualifiedName(), test.fingerprint(), test.explicitlySpecified(), test.selectors()));
}
}
final Runner runner = framework.runner(frameworkArgs, remoteFrameworkArgs, getClass().getClassLoader());
View
9 testing/agent/src/main/java/sbt/FrameworkWrapper.java
@@ -202,7 +202,8 @@ private void runRunner(org.scalatools.testing.Runner runner, Fingerprint fingerp
public boolean isModule() { return subclassFingerprint.isModule(); }
public String superClassName() { return subclassFingerprint.superclassName(); }
};
- runner.run(fullyQualifiedName, oldFingerprint, new EventHandlerWrapper(eventHandler, fullyQualifiedName, subclassFingerprint), args);
+ final String name = taskDef.fullyQualifiedName();
+ runner.run(name, oldFingerprint, new EventHandlerWrapper(eventHandler, name, subclassFingerprint), args);
}
private void runRunner2(org.scalatools.testing.Runner2 runner, Fingerprint fingerprint, EventHandler eventHandler) {
@@ -221,7 +222,8 @@ private void runRunner2(org.scalatools.testing.Runner2 runner, Fingerprint finge
public String annotationName() { return annotatedFingerprint.annotationName(); }
};
}
- runner.run(fullyQualifiedName, oldFingerprint, new EventHandlerWrapper(eventHandler, fullyQualifiedName, fingerprint), args);
+ final String name = taskDef.fullyQualifiedName();
+ runner.run(name, oldFingerprint, new EventHandlerWrapper(eventHandler, name, fingerprint), args);
}
public Task[] execute(EventHandler eventHandler, Logger[] loggers) {
@@ -231,7 +233,8 @@ private void runRunner2(org.scalatools.testing.Runner2 runner, Fingerprint finge
oldLoggers[i] = createOldLogger(loggers[i]);
}
- org.scalatools.testing.Runner runner = oldFramework.testRunner(testClassLoader, oldLoggers);
+ final org.scalatools.testing.Runner runner = oldFramework.testRunner(testClassLoader, oldLoggers);
+ final Fingerprint fingerprint = taskDef.fingerprint();
if (runner instanceof org.scalatools.testing.Runner2) {
runRunner2((org.scalatools.testing.Runner2) runner, fingerprint, eventHandler);
}

0 comments on commit 301c11f

Please sign in to comment.
Something went wrong with that request. Please try again.