-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expand feature mechanism to history plugins
- Loading branch information
Showing
7 changed files
with
64 additions
and
13 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
pitest-entry/src/main/java/org/pitest/mutationtest/HistoryFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package org.pitest.mutationtest; | ||
|
||
import org.pitest.classpath.CodeSource; | ||
import org.pitest.mutationtest.incremental.WriterFactory; | ||
import org.pitest.plugin.ProvidesFeature; | ||
import org.pitest.plugin.ToolClasspathPlugin; | ||
|
||
import java.io.Reader; | ||
import java.util.Optional; | ||
|
||
public interface HistoryFactory extends ToolClasspathPlugin { | ||
History makeHistory(CodeSource code, WriterFactory output, Optional<Reader> input); | ||
public interface HistoryFactory extends ToolClasspathPlugin, ProvidesFeature { | ||
History makeHistory(HistoryParams params, WriterFactory output, Optional<Reader> input); | ||
} |
21 changes: 21 additions & 0 deletions
21
pitest-entry/src/main/java/org/pitest/mutationtest/HistoryParams.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.pitest.mutationtest; | ||
|
||
import org.pitest.classpath.CodeSource; | ||
import org.pitest.plugin.FeatureSelector; | ||
public class HistoryParams { | ||
private final FeatureSelector conf; | ||
private final CodeSource code; | ||
|
||
public HistoryParams(FeatureSelector conf, CodeSource code) { | ||
this.conf = conf; | ||
this.code = code; | ||
} | ||
|
||
public FeatureSelector featureSettings() { | ||
return conf; | ||
} | ||
|
||
public CodeSource code() { | ||
return code; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 12 additions & 3 deletions
15
pitest-entry/src/main/java/org/pitest/mutationtest/incremental/DefaultHistoryFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
package org.pitest.mutationtest.incremental; | ||
|
||
import org.pitest.classpath.CodeSource; | ||
import org.pitest.mutationtest.History; | ||
import org.pitest.mutationtest.HistoryFactory; | ||
import org.pitest.mutationtest.HistoryParams; | ||
import org.pitest.plugin.Feature; | ||
|
||
import java.io.Reader; | ||
import java.util.Optional; | ||
|
||
public class DefaultHistoryFactory implements HistoryFactory { | ||
@Override | ||
public History makeHistory(CodeSource code, WriterFactory output, Optional<Reader> input) { | ||
return new ObjectOutputStreamHistory(code, output, input); | ||
public History makeHistory(HistoryParams params, WriterFactory output, Optional<Reader> input) { | ||
return new ObjectOutputStreamHistory(params.code(), output, input); | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return "Default history"; | ||
} | ||
|
||
@Override | ||
public Feature provides() { | ||
return Feature.named("default_history") | ||
.withOnByDefault(true) | ||
.asInternalFeature() | ||
.withDescription(description()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters