Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows multiple versions of the Information Model (IM) to be validate… #312

Merged
merged 3 commits into from
Mar 26, 2021

Conversation

qchaupds
Copy link
Contributor

@qchaupds qchaupds commented Mar 24, 2021

…d in the same run and optionally report a warning in the report

Closes #188
Closes #210

This pull request resolves two issues: bug occurred when multiple IM versions are used in the labels and to optionally allows the user to get a WARNING
message of multiple versions of IM are used in a bundle. The additional flag is provided for #210: --prefer-all-labels-same-information-model-version

Tested in DEV for #188:

Previously, the user reported the following two labels below did not pass, now it does.

% validate --skip-content-validation -r report_github188_label_valid_both.json -s json -t src/test/resources/github188/bundle_cassini-huygens-coradar.xml src/test/resources/github188/BILQH07S314_D065_T008S02_V02_without_Missing_Area_tag.xml

This test below should not pass for the 2nd label since it does not exist.

validate --skip-content-validation -r report_github188_label_valid_both_with_non_existent_file.json -s json -t src/test/resources/github188/bundle_cassini-huygens-coradar.xml src/test/resources/github188/this_file_does_not_exist.xml

Tested in DEV for #210:

This test will get a WARNING in the report:

% validate --prefer-all-labels-same-information-model-version --skip-content-validation -r report_github210_label_valid_both_with_warning.json
-s json -t src/test/resources/github210/bundle_cassini-huygens-coradar.xml src/test/resources/github210/BILQH07S314_D065_T008S02_V02_without_Missing_Area_tag.xml

This test will not get a WARNING in the report (This is the default mode for validate):
% validate --skip-content-validation -r report_github210_label_valid_both_without_warning.json -s json -t src/test/resources/github210/bundle_cassini-huygens-coradar.xml
src/test/resources/github210/BILQH07S314_D065_T008S02_V02_without_Missing_Area_tag.xml

…d in the same run and optionally report a warning in the report

1.  Added resource github188 to src/test/resources
2.  Added resource github210 to src/test/resources
3.  Add new class to keep a list of unique IMs processed in LabelUtil.java
4.  Add logic to register IM version for each label to LocationUtil.java and many debugs to find the bug in LabelValidator.java
5.  Fix bug by setting schemaLocation for each label to allow multiple versions of the IM to be processed in LabelValidationRule.java
6.  Consolidate long functions into shorter functions for readability in LabelValidationRule.java
7.  Add debug logging to SchemaValidator.java
8.  Add logic to report warning if requested for labels processed if multiple versions of IM processed in ValidateLauncher.java
9.  Add new parameter PREFER_ALL_LABELS_SAME_INFORMATION_MODEL_VERSION to ConfigKey.java
10. Add new parameter PREFER_ALL_LABELS_SAME_INFORMATION_MODEL_VERSION to Flag.java
11. Add new parameter PREFER_ALL_LABELS_SAME_INFORMATION_MODEL_VERSION to FlagOptions.java
12. Add github188 and github210 tests to feature file validate.feature

Refs:

#188 As a user, I want to validate a bundle that uses multiple versions of the Information Model / Discipline LDDs
#210 As a user, I want validate to raise a WARNING when differing versions of IM are used within a bundle
@jordanpadams
Copy link
Member

@qchaupds apologies for the confusion. we want this WARNING to show all of the time. there does not need to be a flag.

Copy link
Member

@jordanpadams jordanpadams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qchaupds

for #210, per #312 (comment), there should not be flag. instead we should always throw a WARNING.

for #188, this looks great. but does this test case actually add any value?

validate --skip-content-validation \
    -r report_github188_label_valid_both_with_non_existent_file.json
    -s json
    -t src/test/resources/github188/bundle_cassini-huygens-coradar.xml
       src/test/resources/github188/this_file_does_not_exist.xml

if not, if it is difficult to come up with a good failure test case, you can skip it. we want to try wherever it makes sense, but we don't want to do it just for the sake of doing it.

Qui T Chau and others added 2 commits March 24, 2021 14:50
…back because report of WARNING is now default

1.  Remove references to optional flag to report WARNING for multiple IM version in ConfigKey.java
2.  Remove references to optional flag to report WARNING for multiple IM version in Flag.java
3.  Remove references to optional flag to report WARNING for multiple IM version in FlagOptions.java
4.  Modify failed test cases due to the WARNING messages are now automatic from feature file validate.feature
5.  Remove some tests that are not as useful from feature file validate.feature

Refs:

#188 As a user, I want to validate a bundle that uses multiple versions of the Information Model / Discipline LDDs
#210 As a user, I want validate to raise a WARNING when differing versions of IM are used within a bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants