Fix for testing on return of warnings for the synthetic FAIR guidelines.

This commit is contained in:
Leonidas Pispiringas 2022-12-16 20:56:39 +02:00
parent 674a8ca833
commit b19f782cfa
2 changed files with 15 additions and 10 deletions

View File

@ -385,9 +385,10 @@ class F2_01M_SPEC extends AbstractGuideline<Document> {
// System.out.println("Weight FAIRG: " + getWeight());
// System.out.println("Max score F2_01M_SPEC: " + MaxScoreF2_01M_SPEC);
ArrayList<String> warnings2 = new ArrayList<>();
ArrayList<String> errors2 = new ArrayList<>();
List<String> warnings2 = new ArrayList<>();
List<String> errors2 = new ArrayList<>();
int score = 0;
for (Map.Entry entry : res_F.results().entrySet()) {
if (res_F.results().get(entry.getKey()).warnings().toString().length() > 2) {
warnings2.add(res_F.results().get(entry.getKey()).warnings().toString());
@ -398,8 +399,11 @@ class F2_01M_SPEC extends AbstractGuideline<Document> {
if (entry.getValue().toString().contains("SUCCESS")) {
score += 2;
}
// System.out.println(res_F.results().get(entry.getKey()).warnings().getClass());
// System.out.println(warnings2.getClass());
}
final Result ress = getResult(warnings2, errors2, score);
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
@ -413,9 +417,9 @@ class F2_01M_SPEC extends AbstractGuideline<Document> {
}
private static Result getResult(ArrayList<String> warnings2, ArrayList<String> errors2, int score) {
private static Result getResult(List<String> warnings2, List<String> errors2, int score) {
return new Result() {
return new Result() {
@Override
public int score() {
return score;

View File

@ -21,7 +21,12 @@ public class Test_FAIR {
// "/Users/lpisp/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/01_data.xml",
// "/Users/lpisp/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/02_data.xml",
// "/Users/lpisp/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/04_data.xml",
"/Users/lpisp/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/03_data.xml",
// "/Users/lpisp/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/03_data.xml",
// "/Users/leonidas/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/03.xml",
// "/Users/leonidas/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/01_data.xml",
// "/Users/leonidas/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/02_data.xml",
// "/Users/leonidas/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/04_data.xml",
"/Users/leonidas/Documents/OpenAIRE/MaDgIK/validator-engine/src/test/resources/openaireguidelinesV3/cris.vtt.fi/03_data.xml",
};
public static void main(String[] args) {
@ -37,11 +42,7 @@ public class Test_FAIR {
scorePerDoc.put(file, result.score());
Map<String, Guideline.Result> results = result.results();
for (Map.Entry entry : results.entrySet()) {
// System.out.println(result.results().get(entry.getKey().toString()));
// System.out.println(entry.getValue().getClass() + ": ");
//// if (!entry.getValue().toString().contains("eu.dnetlib.validator2")) {
System.out.println(entry.getKey() + " = " + entry.getValue());
//// }
System.out.println(entry.getKey() + " = " + entry.getValue());
}