Skip to content

Commit

Permalink
another cleanup step
Browse files Browse the repository at this point in the history
  • Loading branch information
Al Niessner authored and Al Niessner committed Jan 24, 2025
1 parent ab52fb8 commit f40c028
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 88 deletions.
51 changes: 25 additions & 26 deletions src/main/java/gov/nasa/pds/tools/label/LabelValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,31 @@ public double getTotalTimeElapsed() {
* responsible for doing the transformations of the schematrons.
*/
public LabelValidator() throws ParserConfigurationException, TransformerConfigurationException {
this.clear();
}

/**
* Pass in a list of schemas to validate against.
*
* @param schemaFiles A list of schema URLs.
*
*/
public void setSchema(List<URL> schemaFiles) {
this.userSchemaFiles.addAll(schemaFiles);
LOG.debug("setSchema:schemaFiles.size(),schemaFiles {},{}", schemaFiles.size(), schemaFiles);
}

/**
* Pass in a list of transformed schematrons to validate against.
*
* @param schematrons A list of transformed schematrons.
*/
public void setSchematrons(List<String> schematrons) {
userSchematronTransformers = schematrons;
LOG.debug("setSchematrons:schematrons.size(),schematrons {}", schematrons.size());
}
public void clear() throws ParserConfigurationException, TransformerConfigurationException {
this.configurations.clear();
this.configurations.put(SCHEMA_CHECK, true);
this.configurations.put(SCHEMATRON_CHECK, true);
cachedParser = null;
Expand Down Expand Up @@ -191,32 +216,6 @@ public LabelValidator() throws ParserConfigurationException, TransformerConfigur
documentValidators.add(new DefaultDocumentValidator());
schematronTransformer = new SchematronTransformer();
}

/**
* Pass in a list of schemas to validate against.
*
* @param schemaFiles A list of schema URLs.
*
*/
public void setSchema(List<URL> schemaFiles) {
this.userSchemaFiles.addAll(schemaFiles);
LOG.debug("setSchema:schemaFiles.size(),schemaFiles {},{}", schemaFiles.size(), schemaFiles);
}

/**
* Pass in a list of transformed schematrons to validate against.
*
* @param schematrons A list of transformed schematrons.
*/
public void setSchematrons(List<String> schematrons) {
userSchematronTransformers = schematrons;
LOG.debug("setSchematrons:schematrons.size(),schematrons {}", schematrons.size());
}
public void clear() {
this.userSchemaFiles.clear();
this.userSchematronFiles.clear();
this.userSchematronTransformers.clear();
}
/**
* Pass in a hash map of schematron URLs to its transformed schematron object. This is used when
* validating a label against it's referenced schematron.
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/gov/nasa/pds/validate/ValidateLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import java.util.TimeZone;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.stream.StreamSource;
Expand Down Expand Up @@ -291,8 +292,6 @@ public ValidateLauncher() throws TransformerConfigurationException {
checkInbetweenFields = false;
pdfErrorDir = "";
setLabelExtension(Constants.DEFAULT_LABEL_EXTENSION);

this.flushValidators();
}

/**
Expand Down Expand Up @@ -1783,7 +1782,7 @@ public int processMain(String[] args) throws Exception {
* validation data between runs, which can cause issues, specifically when using varying
* dictionaries and catalog files.
*/
public void flushValidators() {
public void flushValidators() throws ParserConfigurationException, TransformerConfigurationException {
if (this.factory != null) {
this.factory.flush();
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/cucumber/CucumberTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
@CucumberOptions(plugin = {"pretty", "html:target/cucumber.html"},
features = "src/test/resources/features/", glue = "cucumber")
public class CucumberTest {

public CucumberTest() {}

}
Loading

0 comments on commit f40c028

Please sign in to comment.