-
Notifications
You must be signed in to change notification settings - Fork 9
GH Issue 1257: Check for duplicates among field names, import aliases, and parent import aliases #3128
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
Merged
Merged
GH Issue 1257: Check for duplicates among field names, import aliases, and parent import aliases #3128
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0b49501
GH Issue 1257: Check for duplicates among field names, import aliases…
labkey-susanh c32433e
Revert change to log message
labkey-susanh 599d66e
Move field validation to DomainUtil.validateProperties to be applicab…
labkey-susanh 6b45175
spacing
labkey-susanh 19928c9
Merge remote-tracking branch 'origin/develop' into fb_aliasDupes
labkey-susanh 5165002
Merge remote-tracking branch 'origin/develop' into fb_aliasDupes
labkey-susanh 4d4333b
Remove protection against existing parent aliases colliding field names
labkey-susanh 5e9b634
Add Unit tests and one designer test for overlapping aliases
labkey-susanh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -301,7 +301,69 @@ public void testCustomProperties() | |
| assertTextPresent(stringCol1.getLabel(), stringCol2.getLabel(), stringCol3.getLabel(), calcCol.getLabel(), "PlainValue", "PercentValue", "PlainValueConcat"); | ||
| } | ||
|
|
||
| // Issue 47280: LKSM: Trailing/Leading whitespace in Source name won't resolve when deriving samples | ||
| @Test // GH Issue 1257 | ||
| public void testOverlappingAliases() | ||
| { | ||
| final String sampleTypeName = "OverlappingAliasSampleType"; | ||
| final String fieldOne = "AliasFieldOne"; | ||
| final String fieldTwo = "AliasFieldTwo"; | ||
| final String sharedAlias = "sharedAlias"; | ||
|
|
||
| SampleTypeHelper sampleHelper = new SampleTypeHelper(this); | ||
|
|
||
| clickProject(PROJECT_NAME); | ||
| CreateSampleTypePage createPage = sampleHelper | ||
| .goToCreateNewSampleType() | ||
| .setName(sampleTypeName); | ||
| DomainFormPanel fieldsPanel = createPage.getFieldsPanel(); | ||
|
|
||
| log("Verify there can be no duplicate import aliases for different fields in a sample type (case-insensitive). "); | ||
| fieldsPanel.addField(fieldOne).setImportAliases(sharedAlias); | ||
| fieldsPanel.addField(fieldTwo).setImportAliases(sharedAlias); | ||
|
|
||
| checker().verifyThat("Expected an error when two fields share an import alias", | ||
| String.join("\n", createPage.clickSaveExpectingErrors()), | ||
| containsString("You have 2 field errors.")); | ||
| checker().screenShotIfNewError("duplicateImportAlias"); | ||
|
|
||
| log("Aliases differing only by case are still duplicates."); | ||
| createPage = new CreateSampleTypePage(this.getDriver()); | ||
| fieldsPanel.getField(fieldTwo).setImportAliases(sharedAlias.toUpperCase()); | ||
| checker().verifyThat("Expected an error when two fields share an import alias differing only by case", | ||
| String.join("\n", createPage.clickSaveExpectingErrors()), | ||
| containsString("You have 2 field errors.")); | ||
| checker().screenShotIfNewError("duplicateImportAliasIgnoringCase"); | ||
|
|
||
| log("Verify there can be no import aliases that collide with field names (case-insensitive)."); | ||
| createPage = new CreateSampleTypePage(this.getDriver()); | ||
| fieldsPanel.getField(fieldTwo).setImportAliases(""); | ||
| fieldsPanel.getField(fieldOne).setImportAliases(fieldTwo); | ||
| checker().verifyThat("Expected an error when an import alias matches another field's name", | ||
| String.join("\n", createPage.clickSaveExpectingErrors()), | ||
| containsString("Import alias '" + fieldTwo + "' on field '" + fieldOne + "' conflicts with a field name.")); | ||
| checker().screenShotIfNewError("importAliasConflictsWithFieldName"); | ||
|
Comment on lines
+341
to
+344
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above. |
||
|
|
||
| log("An alias that matches a field name except for case is still a conflict."); | ||
| createPage = new CreateSampleTypePage(this.getDriver()); | ||
| fieldsPanel.getField(fieldOne).setImportAliases(fieldTwo.toLowerCase()); | ||
| checker().verifyThat("Expected an error when an import alias matches another field's name except for case", | ||
| String.join("\n", createPage.clickSaveExpectingErrors()), | ||
| containsString("Import alias '" + fieldTwo.toLowerCase() + "' on field '" + fieldOne + "' conflicts with a field name.")); | ||
| checker().screenShotIfNewError("importAliasConflictsWithFieldNameIgnoringCase"); | ||
|
|
||
| log("An alias that repeats its own field's name is redundant but not ambiguous, so it should be allowed."); | ||
| fieldsPanel.getField(fieldOne).setImportAliases(fieldOne); | ||
| createPage.clickSave(); | ||
|
|
||
| clickProject(PROJECT_NAME); | ||
| UpdateSampleTypePage updatePage = sampleHelper.goToEditSampleType(sampleTypeName); | ||
| checker().verifyEquals("Import alias matching its own field name was not saved", | ||
| fieldOne, updatePage.getFieldsPanel().getField(fieldOne).getImportAliases()); | ||
| checker().screenShotIfNewError("selfReferencingImportAlias"); | ||
| updatePage.clickCancel(); | ||
| } | ||
|
|
||
| // Issue 47280: LKSM: Trailing/Leading whitespace in Source name won't resolve when deriving samples | ||
| @Test | ||
| public void testImportSamplesWithTrailingSpace() throws IOException, CommandException | ||
| { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, you can give a screenshot name to the .withScreenshot call:
checker().withScreenshot("duplicateImportAlias").verifyThat("Expected an error when two fields share an import alias",