-
Notifications
You must be signed in to change notification settings - Fork 3
Ena 5863 updating validation scope #148
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
e6b05e3
6a4becd
17b6b7b
f80e8e9
b2b1c90
f96a364
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,48 +10,45 @@ | |
| */ | ||
| package uk.ac.ebi.embl.api.validation; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.List; | ||
|
|
||
| public enum ValidationScope { | ||
| /** Putff (ENA) */ | ||
| EMBL(Group.SEQUENCE), | ||
| EMBL(Group.PUTFF), | ||
| /** Putff (NCBI) */ | ||
| NCBI(Group.SEQUENCE), | ||
| NCBI(Group.PUTFF, Group.NCBI), | ||
| /** Putff (NCBI master) */ | ||
| NCBI_MASTER(Group.SEQUENCE), | ||
| NCBI_MASTER(Group.PUTFF, Group.NCBI), | ||
| /** Pipeline (Webin-CLI sequence scope) */ | ||
| EMBL_TEMPLATE(Group.SEQUENCE), | ||
| EMBL_TEMPLATE(Group.PIPELINE), | ||
| /** Putff (patent protein) */ | ||
| EPO_PEPTIDE(Group.SEQUENCE), | ||
| EPO_PEPTIDE(Group.EPO), | ||
| /** Putff (patent) */ | ||
| EPO(Group.SEQUENCE), | ||
| /** TODO: remove if not used */ | ||
| INSDC(Group.SEQUENCE), | ||
| /** TODO: remove if not used */ | ||
| EGA(Group.SEQUENCE), | ||
| /** TODO: remove if not used */ | ||
| ARRAYEXPRESS(Group.SEQUENCE), | ||
| EPO(Group.EPO), | ||
| /** Pipeline (Webin-CLI genome scope) */ | ||
| ASSEMBLY_MASTER(Group.ASSEMBLY), | ||
| ASSEMBLY_MASTER(Group.ASSEMBLY, Group.PIPELINE), | ||
| /** Pipeline (Webin-CLI genome scope) */ | ||
| ASSEMBLY_CONTIG(Group.ASSEMBLY), | ||
| ASSEMBLY_CONTIG(Group.ASSEMBLY, Group.PIPELINE), | ||
| /** Pipeline (Webin-CLI genome scope) */ | ||
| ASSEMBLY_SCAFFOLD(Group.ASSEMBLY), | ||
| ASSEMBLY_SCAFFOLD(Group.ASSEMBLY, Group.PIPELINE), | ||
| /** Pipeline (Webin-CLI genome scope) */ | ||
| ASSEMBLY_CHROMOSOME(Group.ASSEMBLY), | ||
| ASSEMBLY_CHROMOSOME(Group.ASSEMBLY, Group.PIPELINE), | ||
| /** Pipeline (Webin-CLI transcriptome scope) */ | ||
| ASSEMBLY_TRANSCRIPTOME(Group.ASSEMBLY); | ||
| ASSEMBLY_TRANSCRIPTOME(Group.PIPELINE); | ||
|
|
||
| private final Group group; | ||
| private final List<Group> groups; | ||
|
|
||
| ValidationScope(Group group) { | ||
| this.group = group; | ||
| ValidationScope(Group... groups) { | ||
| this.groups = Arrays.asList(groups); | ||
| } | ||
|
|
||
| public boolean isInGroup(Group group) { | ||
| return this.group == group; | ||
| return this.groups.contains(group); | ||
| } | ||
|
|
||
| public Group group() { | ||
| return this.group; | ||
| public List<Group> groups() { | ||
| return this.groups; | ||
| } | ||
|
|
||
| public static ValidationScope get(String scope) { | ||
|
|
@@ -77,8 +74,11 @@ public int getAssemblyLevel() { | |
| } | ||
|
|
||
| public enum Group { | ||
| PIPELINE, | ||
|
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. Suggest to add a few comments -> /** Webin submissions processed by pipelines. */ /** Non-Webin submissions processed by putff. */ |
||
| PUTFF, | ||
| ASSEMBLY, | ||
| SEQUENCE | ||
| NCBI, | ||
| EPO | ||
| } | ||
|
|
||
| public static ValidationScope getScope(FileType fileType) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| package uk.ac.ebi.embl.api.validation; | ||
|
|
||
| import static org.junit.Assert.assertEquals; | ||
| import static org.junit.Assert.assertTrue; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.StringWriter; | ||
|
|
@@ -122,4 +123,13 @@ public void testWriteTextMessageChangedFormatter() throws IOException { | |
| ValidationMessage.setDefaultMessageFormatter(mf); | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void testValidationScopeWithGroup() { | ||
| assertTrue(ValidationScope.NCBI.isInGroup(ValidationScope.Group.NCBI)); | ||
|
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. Please move the validation scope and group tests into a new class: and test that all ValidationScope enums against isInGroup: |
||
| assertTrue(ValidationScope.NCBI.isInGroup(ValidationScope.Group.PUTFF)); | ||
|
|
||
| assertTrue(ValidationScope.ASSEMBLY_MASTER.isInGroup(ValidationScope.Group.ASSEMBLY)); | ||
| assertTrue(ValidationScope.ASSEMBLY_MASTER.isInGroup(ValidationScope.Group.PIPELINE)); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,16 +87,39 @@ public void testIsInValidationScope_Right() { | |
| } | ||
|
|
||
| @Test | ||
| public void testIsInValidationScope_Many() { | ||
| assertTrue( | ||
| plan.isInValidationScope( | ||
| new ValidationScope[] {ValidationScope.EMBL, ValidationScope.INSDC})); | ||
| public void testIsInValidationScopePutffGroup() { | ||
|
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 the previous one) -> Please move the validation scope and group tests into a new class: and test that all ValidationScope enums against isInGroup: |
||
| assertTrue(plan.validationScope.isInGroup(ValidationScope.Group.PUTFF)); | ||
| assertFalse(plan.validationScope.isInGroup(ValidationScope.Group.PIPELINE)); | ||
| } | ||
|
|
||
| @Test | ||
| public void testIsInValidationScope_ManyWrong() { | ||
| assertFalse( | ||
| plan.isInValidationScope( | ||
| new ValidationScope[] {ValidationScope.EPO, ValidationScope.INSDC})); | ||
| public void testIsInValidationScopePipelineGroup() { | ||
|
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. Replicate what is in the ValidationScope::testValidationScopeIsInGroup() in ValidationPlanTest. The only difference is that ValidationPlanTest creates the ValidationPlan. |
||
| ValidationPlan plan = | ||
| new ValidationPlan(ValidationScope.ASSEMBLY_MASTER, false) { | ||
| @Override | ||
| public ValidationResult execute(Object target) { | ||
| return null; | ||
| } | ||
| }; | ||
|
|
||
| assertTrue(plan.validationScope.isInGroup(ValidationScope.Group.PIPELINE)); | ||
| assertTrue(plan.validationScope.isInGroup(ValidationScope.Group.ASSEMBLY)); | ||
| assertFalse(plan.validationScope.isInGroup(ValidationScope.Group.PUTFF)); | ||
| } | ||
|
|
||
| @Test | ||
| public void testIsInValidationScopeNcbiGroup() { | ||
|
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. Replicate what is in the ValidationScope::testValidationScopeIsInGroup() in ValidationPlanTest. The only difference is that ValidationPlanTest creates the ValidationPlan. |
||
| ValidationPlan plan = | ||
| new ValidationPlan(ValidationScope.NCBI, false) { | ||
| @Override | ||
| public ValidationResult execute(Object target) { | ||
| return null; | ||
| } | ||
| }; | ||
|
|
||
| assertTrue(plan.validationScope.isInGroup(ValidationScope.Group.NCBI)); | ||
| assertTrue(plan.validationScope.isInGroup(ValidationScope.Group.PUTFF)); | ||
| assertFalse(plan.validationScope.isInGroup(ValidationScope.Group.ASSEMBLY)); | ||
|
|
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
I think we should have only four groups (not sure what to call them):
We might wish to rename: