Make SubmitRuleEvaluator usable for testing prolog rules.
For the purpose of testing submit rules the SubmitRuleEvaluator needs more flexibility like skipping the submit filters and loading prolog rules from a caller provided input stream. This change is a preparation for refactoring of the test-submit-rule command which currently duplicates most of the code for finding and executing the prolog rules. Change-Id: I54086590fa5dc5cefdd9c36ca2e8587d374bd988 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
This commit is contained in:
@@ -42,6 +42,7 @@ import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -168,6 +169,20 @@ public class ProjectState {
|
||||
return envFactory.create(pmc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #newPrologEnvironment()} but instead of reading the rules.pl
|
||||
* read the provided input stream.
|
||||
*
|
||||
* @param name a name of the input stream. Could be any name.
|
||||
* @param in InputStream to read prolog rules from
|
||||
* @throws CompileException
|
||||
*/
|
||||
public PrologEnvironment newPrologEnvironment(String name, InputStream in)
|
||||
throws CompileException {
|
||||
PrologMachineCopy pmc = rulesCache.loadMachine(name, in);
|
||||
return envFactory.create(pmc);
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return config.getProject();
|
||||
}
|
||||
|
Reference in New Issue
Block a user