Skip to content

Commit

Permalink
Fix tests by preventing validate internal error
Browse files Browse the repository at this point in the history
Allows tests to run as expected

Updates also includes adding copy of `registered_context_products.json` to avoid having to generate these on the fly.

Resolves #822
  • Loading branch information
jordanpadams committed Nov 6, 2024
1 parent 8068936 commit 1f02f50
Show file tree
Hide file tree
Showing 4 changed files with 53,155 additions and 101 deletions.
13 changes: 2 additions & 11 deletions model-lddtool/src/test/java/cucumber/ValidateStepDefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ public class ValidateStepDefs {
private static final Logger LOG = LoggerFactory.getLogger(ValidateStepDefs.class);
private static final String DEFAULT_REPORT_FILENAME = "report_{testDir}.json";
private static final String DEFAULT_VALIDATE_ARGS =
"--disable-context-mismatch-warnings --report-style json --skip-content-validation --report-file {reportDir}/"
"--disable-context-mismatch-warnings --report-style json --skip-content-validation --skip-context-validation --report-file {reportDir}/"
+ DEFAULT_REPORT_FILENAME + " ";
private static final String VALIDATE_UPDATE_CONTEXT_ARG = "--update-context-products";
private static final String VALIDATE_CONFIG_FILE = "registered_context_products.json";
private static final String DEFAULT_CORE_ARGS = "-p";
private static final String DEFAULT_LDDTOOL_ARGS = "-lp";
Expand Down Expand Up @@ -77,8 +76,7 @@ void setUp() throws Exception {
FileUtils.forceMkdir(this.outputData); // Create directory if one does not already exist.
System.setProperty("resources.home", TestConstants.TEST_OUT_DIR);
this.launcher = new ValidateLauncher();
initContextProductsJson(TestConstants.TEST_OUT_DIR, this.launcher);
System.setProperty("resources.home", TestConstants.TEST_OUT_DIR);
System.setProperty("resources.home", TestConstants.RESOURCES_DIR + File.pathSeparator + VALIDATE_CONFIG_FILE);
this.refOutputValue = DEFAULT_REPORT_FILENAME;
this.reportDir = TestConstants.TEST_OUT_DIR;
this.resourceDir = TestConstants.TEST_DATA_DIR;
Expand All @@ -98,13 +96,6 @@ void tearDown() throws Exception {
CrossLabelFileAreaReferenceChecker.reset();
}

void initContextProductsJson(String basedir, ValidateLauncher launcher) throws Exception {
LOG.info("Initializing context products config file for Validate");
if (!(new File(basedir + File.separator + VALIDATE_CONFIG_FILE).isFile())) {
launcher.processMain(new String[] {VALIDATE_UPDATE_CONTEXT_ARG});
}
}

private int getMessageCountBasedOnProblemType(String problemEnum, JsonObject reportJson) {
// Given an output report, retrieve the 'count' field based on the problemEnum
// value.
Expand Down
Loading

0 comments on commit 1f02f50

Please sign in to comment.