Cleansing

This commit is contained in:
Philip Helger
2024-07-09 18:37:53 +02:00
parent 8b2a11c5da
commit 12a3abde66
46 changed files with 394 additions and 402 deletions

View File

@@ -332,7 +332,7 @@ public class Main {
public static void main(String[] args) {
try {
CommandLine cmd;
CommandLineParser parser = new BasicParser();
CommandLineParser parser = new DefaultParser();
// create Options object
Options options = new Options();
@@ -427,7 +427,7 @@ public class Main {
performUBL(sourceName, outName);
optionsRecognized = true;
} else if ((action != null) && (action.equals("validate"))) {
optionsRecognized = performValidate(sourceName, noNotices != null && noNotices, cmd.getOptionValue("logAppend"));
optionsRecognized = performValidate(sourceName, noNotices, cmd.getOptionValue("logAppend"));
} else if ((action != null) && (action.equals("validateExpectValid"))) {
optionsRecognized = performValidateExpect(true, directoryName);
} else if ((action != null) && (action.equals("validateExpectInvalid"))) {
@@ -585,7 +585,7 @@ public class Main {
if (attachmentFilenames == null) {
byte attachmentContents[] = null;
String attachmentFilename, attachmentMime, attachmentDescription;
String attachmentFilename, attachmentMime;
if (!noAttachments) {
attachmentFilename = getFilenameFromUser("Additional file attachments filename (empty for none)", "", "pdf", true, false);
if (attachmentFilename.length() != 0) {

View File

@@ -14,9 +14,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmlunit.builder.Input;
import org.xmlunit.xpath.JAXPXPathEngine;
import org.xmlunit.xpath.XPathEngine;
import org.mustangproject.validator.ZUGFeRDValidator;
import static org.xmlunit.assertj.XmlAssert.assertThat;
@@ -50,25 +47,23 @@ public class ValidatorFileWalker
Date date = new Date();
String expectedString="valid";
if (!expectValid) {
expectedString="invalid";
}
expectedString="invalid";
}
if ((attr!=null)&&(attr.isRegularFile())) {
if (matcher.matches(file.getFileName())) {
boolean thisResultValid=true;
String thisResultString=" valid";
try {
assertThat(zul.validate(file.toAbsolutePath().toString())).valueByXPath("/validation/summary/@status")
.asString()
.isEqualTo(expectedString);
} catch (AssertionError ae) {
thisResultValid=false;
thisResultString="invalid";
allValid=false;
}
LOGGER.info(String.format("\n@%s Testing file %d: %s (%s)", dateFormat.format(date), fileCount++, thisResultString, file));
}
try {
assertThat(zul.validate(file.toAbsolutePath().toString())).valueByXPath("/validation/summary/@status")
.asString()
.isEqualTo(expectedString);
} catch (AssertionError ae) {
thisResultString="invalid";
allValid=false;
}
LOGGER.info(String.format("\n@%s Testing file %d: %s (%s)", dateFormat.format(date), fileCount++, thisResultString, file));
}
}
return FileVisitResult.CONTINUE;
}