diff --git a/build.gradle b/build.gradle index 59200945..389453ae 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { archivesBaseName = 'sequencetools' group = 'uk.ac.ebi.ena.sequence' -version = '2.18.11' +version = '2.19.1' sourceCompatibility = 1.8 targetCompatibility = 1.8 diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/ValidationScope.java b/src/main/java/uk/ac/ebi/embl/api/validation/ValidationScope.java index 7d8620a3..1f364533 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/ValidationScope.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/ValidationScope.java @@ -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 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 groups() { + return this.groups; } public static ValidationScope get(String scope) { @@ -77,8 +74,11 @@ public int getAssemblyLevel() { } public enum Group { + PIPELINE, + PUTFF, ASSEMBLY, - SEQUENCE + NCBI, + EPO } public static ValidationScope getScope(FileType fileType) { @@ -87,4 +87,24 @@ public static ValidationScope getScope(FileType fileType) { } return ValidationScope.EMBL; } + + public static boolean isPipelineGroup(ValidationScope scope){ + return scope.isInGroup(Group.PIPELINE); + } + + public static boolean isPutffGroup(ValidationScope scope){ + return scope.isInGroup(Group.PUTFF); + } + + public static boolean isAssemblyGroup(ValidationScope scope){ + return scope.isInGroup(Group.ASSEMBLY); + } + + public static boolean isNcbiGroup(ValidationScope scope){ + return scope.isInGroup(Group.NCBI); + } + + public static boolean isEpoGroup(ValidationScope scope){ + return scope.isInGroup(Group.EPO); + } } diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/DescriptionCheck.java b/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/DescriptionCheck.java index eb1000f0..85759c3b 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/DescriptionCheck.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/DescriptionCheck.java @@ -19,7 +19,6 @@ @ExcludeScope( validationScope = { - ValidationScope.ARRAYEXPRESS, ValidationScope.ASSEMBLY_CHROMOSOME, ValidationScope.ASSEMBLY_CONTIG, ValidationScope.ASSEMBLY_MASTER, diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/ReferenceCheck.java b/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/ReferenceCheck.java index c43f58c4..e14aa547 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/ReferenceCheck.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/ReferenceCheck.java @@ -30,9 +30,6 @@ ValidationScope.EMBL_TEMPLATE, ValidationScope.EPO_PEPTIDE, ValidationScope.NCBI, - ValidationScope.ARRAYEXPRESS, - ValidationScope.EGA, - ValidationScope.INSDC, ValidationScope.NCBI_MASTER }) public class ReferenceCheck extends EntryValidationCheck { diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/check/feature/NCBIQualifierCheck.java b/src/main/java/uk/ac/ebi/embl/api/validation/check/feature/NCBIQualifierCheck.java index 7863d300..c8d09450 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/check/feature/NCBIQualifierCheck.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/check/feature/NCBIQualifierCheck.java @@ -28,19 +28,16 @@ + "Feature qualifier \\\"{0}\\\" value \\\"{1}\\\" does not comply to the qualifier specifications. Refer to the feature documentation or ask a curator for guidance.\"") @ExcludeScope( validationScope = { - ValidationScope.ARRAYEXPRESS, ValidationScope.ASSEMBLY_CHROMOSOME, ValidationScope.ASSEMBLY_CONTIG, ValidationScope.ASSEMBLY_MASTER, ValidationScope.ASSEMBLY_SCAFFOLD, ValidationScope.ASSEMBLY_TRANSCRIPTOME, - ValidationScope.EGA, ValidationScope.EMBL, ValidationScope.EMBL, ValidationScope.EMBL_TEMPLATE, ValidationScope.EPO, ValidationScope.EPO_PEPTIDE, - ValidationScope.INSDC, ValidationScope.NCBI_MASTER }) public class NCBIQualifierCheck extends FeatureValidationCheck { diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/fixer/entry/JournalFix.java b/src/main/java/uk/ac/ebi/embl/api/validation/fixer/entry/JournalFix.java index 16971923..5b31ea56 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/fixer/entry/JournalFix.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/fixer/entry/JournalFix.java @@ -26,19 +26,16 @@ @Description("Journal has been modified from:{0} to:{1}") @ExcludeScope( validationScope = { - ValidationScope.ARRAYEXPRESS, ValidationScope.ASSEMBLY_CHROMOSOME, ValidationScope.ASSEMBLY_CONTIG, ValidationScope.ASSEMBLY_MASTER, ValidationScope.ASSEMBLY_SCAFFOLD, ValidationScope.ASSEMBLY_TRANSCRIPTOME, - ValidationScope.EGA, ValidationScope.EMBL, ValidationScope.EMBL, ValidationScope.EMBL_TEMPLATE, ValidationScope.EPO, ValidationScope.EPO_PEPTIDE, - ValidationScope.INSDC, ValidationScope.NCBI_MASTER }) public class JournalFix extends EntryValidationCheck { diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/fixer/sourcefeature/CountryQualifierFix.java b/src/main/java/uk/ac/ebi/embl/api/validation/fixer/sourcefeature/CountryQualifierFix.java index 6cc30ac9..da6af8c0 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/fixer/sourcefeature/CountryQualifierFix.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/fixer/sourcefeature/CountryQualifierFix.java @@ -29,20 +29,17 @@ @Description("\"{0}\" qualifier value \"{1}\" is invalid, a note has been added.") @ExcludeScope( validationScope = { - ValidationScope.ARRAYEXPRESS, ValidationScope.ASSEMBLY_CHROMOSOME, ValidationScope.ASSEMBLY_CONTIG, ValidationScope.ASSEMBLY_MASTER, ValidationScope.NCBI_MASTER, ValidationScope.ASSEMBLY_SCAFFOLD, ValidationScope.ASSEMBLY_TRANSCRIPTOME, - ValidationScope.EGA, ValidationScope.EMBL, ValidationScope.EMBL, ValidationScope.EMBL_TEMPLATE, ValidationScope.EPO, ValidationScope.EPO_PEPTIDE, - ValidationScope.INSDC }) public class CountryQualifierFix extends FeatureValidationCheck { private static final String COUNTRY_QUALIFIER_VALUE_FIX_ID_1 = "CountryQualifierFix_1"; diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/plan/ValidationPlan.java b/src/main/java/uk/ac/ebi/embl/api/validation/plan/ValidationPlan.java index 30266e13..5e46c667 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/plan/ValidationPlan.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/plan/ValidationPlan.java @@ -197,7 +197,7 @@ protected boolean isInValidationScopeGroup(ValidationScope.Group[] validationSco if (groupScope == null) { continue; } - if (groupScope.equals(validationScope.group())) return true; + if (validationScope.groups().contains(groupScope)) return true; } return false; } diff --git a/src/main/java/uk/ac/ebi/embl/flatfile/reader/embl/EmblEntryReader.java b/src/main/java/uk/ac/ebi/embl/flatfile/reader/embl/EmblEntryReader.java index 66c66653..55487741 100644 --- a/src/main/java/uk/ac/ebi/embl/flatfile/reader/embl/EmblEntryReader.java +++ b/src/main/java/uk/ac/ebi/embl/flatfile/reader/embl/EmblEntryReader.java @@ -18,7 +18,9 @@ import uk.ac.ebi.embl.api.entry.Entry; import uk.ac.ebi.embl.api.validation.Severity; import uk.ac.ebi.embl.api.validation.ValidationResult; +import uk.ac.ebi.embl.api.validation.ValidationScope; import uk.ac.ebi.embl.api.validation.fixer.entry.SubmitterAccessionFix; +import uk.ac.ebi.embl.api.validation.plan.EmblEntryValidationPlanProperty; import uk.ac.ebi.embl.flatfile.EmblTag; import uk.ac.ebi.embl.flatfile.reader.*; import uk.ac.ebi.embl.flatfile.validation.FlatFileValidations; @@ -44,6 +46,7 @@ public class EmblEntryReader extends EntryReader { private boolean isReducedFlatfile = false; private Format format = null; + private ValidationScope scope; public enum Format { EMBL_FORMAT, @@ -58,10 +61,10 @@ public enum Format { // TODO: delete! public EmblEntryReader(BufferedReader reader) { - this(reader, Format.EMBL_FORMAT, null); + this(reader, Format.EMBL_FORMAT, null, ValidationScope.EMBL); } - public EmblEntryReader(BufferedReader reader, Format format, String fileId) { + public EmblEntryReader(BufferedReader reader, Format format, String fileId, ValidationScope scope) { super(new EmblLineReader(reader, fileId)); @@ -70,7 +73,7 @@ public EmblEntryReader(BufferedReader reader, Format format, String fileId) { } public EmblEntryReader( - BufferedReader reader, Format format, String fileId, ReaderOptions readerOptions) { + BufferedReader reader, Format format, String fileId, ReaderOptions readerOptions,ValidationScope scope) { super(new EmblLineReader(reader, fileId).setReaderOptions(readerOptions)); this.format = format; @@ -79,10 +82,10 @@ public EmblEntryReader( public EmblEntryReader(RandomAccessFile raf) { - this(raf, Format.EMBL_FORMAT, null); + this(raf, Format.EMBL_FORMAT, null, ValidationScope.EMBL); } - public EmblEntryReader(RandomAccessFile raf, Format format, String fileId) { + public EmblEntryReader(RandomAccessFile raf, Format format, String fileId, ValidationScope scope) { super(new EmblLineReader(raf, fileId)); addBlockReaders(format); } @@ -261,6 +264,182 @@ private void addBlockReaders(Format format) { } } + + private void addBlockReadersByScope(ValidationScope scope) { + getBlockCounter().clear(); + getSkipTagCounter().clear(); + if(ValidationScope.isPipelineGroup(scope)){ // Abstract for Assembly / template/ transcriptome + + }else if(ValidationScope.isPutffGroup(scope)){ // Abstract for NCBI / EPO / ENA + + } else if(ValidationScope.isAssemblyGroup(scope)){ // sub group of pipeline group + + }else if(ValidationScope.isNcbiGroup(scope)){ // sub of putff + + }else if(ValidationScope.isEpoGroup(scope)){ // sub of putff + + } + + if (format.equals(Format.REDUCED_FILE_FORMAT)) { // Leave is as it is + isReducedFlatfile = true; + addBlockReader(new IDReader(lineReader)); + addBlockReader(new COReader(lineReader)); + addBlockReader(new SQReader(lineReader)); + addBlockReader(new FHReader(lineReader)); + } else if (format.equals(Format.EMBL_FORMAT)) { // This will be used by putff no ncbi flag ENA and must split Template / transcriptome out of this from pipelines. + addBlockReader(new IDReader(lineReader)); + addBlockReader(new ACReader(lineReader)); + addBlockReader(new DEReader(lineReader)); + addBlockReader(new KWReader(lineReader)); + addBlockReader(new DTReader(lineReader)); + addBlockReader(new PRReader(lineReader)); + addBlockReader(new ACStarReader(lineReader)); + addBlockReader(new STStarReader(lineReader)); + addBlockReader(new COReader(lineReader)); + addBlockReader(new SQReader(lineReader)); + addBlockReader(new AHReader(lineReader)); + addBlockReader(new FHReader(lineReader)); + addBlockReader(new CCReader(lineReader)); + addBlockReader(new DRReader(lineReader)); + addBlockReader(new OSReader(lineReader)); + addBlockReader(new OCReader(lineReader)); + addBlockReader(new OGReader(lineReader)); + addBlockReader(new ASReader(lineReader)); + addBlockReader(new RAReader(lineReader)); + addBlockReader(new RCReader(lineReader)); + addBlockReader(new RGReader(lineReader)); + addBlockReader(new RLReader(lineReader)); + addBlockReader(new RNReader(lineReader)); + addBlockReader(new RPReader(lineReader)); + addBlockReader(new RTReader(lineReader)); + addBlockReader(new RXReader(lineReader)); + } else if (format.equals(Format.MASTER_FORMAT)) { // Leave is as it is + addBlockReader(new IDReader(lineReader)); + addBlockReader(new ACReader(lineReader)); + addBlockReader(new DEReader(lineReader)); + addBlockReader(new KWReader(lineReader)); + addBlockReader(new DTReader(lineReader)); + addBlockReader(new PRReader(lineReader)); + addBlockReader(new FHReader(lineReader)); + addBlockReader(new CCReader(lineReader)); + addBlockReader(new DRReader(lineReader)); + addBlockReader(new OSReader(lineReader)); + addBlockReader(new OCReader(lineReader)); + addBlockReader(new OGReader(lineReader)); + addBlockReader(new RAReader(lineReader)); + addBlockReader(new RCReader(lineReader)); + addBlockReader(new RGReader(lineReader)); + addBlockReader(new RLReader(lineReader)); + addBlockReader(new RNReader(lineReader)); + addBlockReader(new RPReader(lineReader)); + addBlockReader(new RTReader(lineReader)); + addBlockReader(new RXReader(lineReader)); + addBlockReader(new MasterWGSReader(lineReader)); + addBlockReader(new MasterCONReader(lineReader)); + addBlockReader(new MasterTSAReader(lineReader)); + addBlockReader(new MasterTLSReader(lineReader)); + } else if (format.equals(Format.CDS_FORMAT)) { // Leave is as it is + addBlockReader(new IDReader(lineReader)); + addBlockReader(new PAReader(lineReader)); + addBlockReader(new DTReader(lineReader)); + addBlockReader(new DEReader(lineReader)); + addBlockReader(new KWReader(lineReader)); + addBlockReader(new SQReader(lineReader)); + addBlockReader(new FHReader(lineReader)); + addBlockReader(new DRReader(lineReader)); + addBlockReader(new OSReader(lineReader)); + addBlockReader(new OCReader(lineReader)); + addBlockReader(new OGReader(lineReader)); + addBlockReader(new OXReader(lineReader)); + addBlockReader(new PRReader(lineReader)); + addBlockReader(new RAReader(lineReader)); + addBlockReader(new RCReader(lineReader)); + addBlockReader(new RGReader(lineReader)); + addBlockReader(new RLReader(lineReader)); + addBlockReader(new RNReader(lineReader)); + addBlockReader(new RPReader(lineReader)); + addBlockReader(new RTReader(lineReader)); + addBlockReader(new RXReader(lineReader)); + } else if (format.equals(Format.EPO_FORMAT)) { // Leave is as it is + addBlockReader(new IDReader(lineReader)); + addBlockReader(new ACReader(lineReader)); + addBlockReader(new SQReader(lineReader)); + addBlockReader(new FHReader(lineReader)); + addBlockReader(new OSReader(lineReader)); + addBlockReader(new RAReader(lineReader)); + addBlockReader(new RLReader(lineReader)); + addBlockReader(new RNReader(lineReader)); + addBlockReader(new RTReader(lineReader)); + } else if (format.equals(Format.NCR_FORMAT)) { // Leave is as it is + EXACTLY_ONCE_BLOCKS = Arrays.asList(EmblTag.ID_TAG, EmblTag.DE_TAG); + addBlockReader(new IDReader(lineReader, true)); + addBlockReader(new PAReader(lineReader)); + addBlockReader(new ACReader(lineReader)); + addBlockReader(new DEReader(lineReader)); + addBlockReader(new KWReader(lineReader)); + addBlockReader(new DTReader(lineReader)); + addBlockReader(new PRReader(lineReader)); + addBlockReader(new ACStarReader(lineReader)); + addBlockReader(new STStarReader(lineReader)); + addBlockReader(new COReader(lineReader)); + addBlockReader(new SQReader(lineReader)); + addBlockReader(new AHReader(lineReader)); + addBlockReader(new FHReader(lineReader)); + addBlockReader(new CCReader(lineReader)); + addBlockReader(new DRReader(lineReader)); + addBlockReader(new OSReader(lineReader)); + addBlockReader(new OCReader(lineReader)); + addBlockReader(new OGReader(lineReader)); + addBlockReader(new ASReader(lineReader)); + addBlockReader(new RAReader(lineReader)); + addBlockReader(new RCReader(lineReader)); + addBlockReader(new RGReader(lineReader)); + addBlockReader(new RLReader(lineReader)); + addBlockReader(new RNReader(lineReader)); + addBlockReader(new RPReader(lineReader)); + addBlockReader(new RTReader(lineReader)); + addBlockReader(new RXReader(lineReader)); + } else if (format.equals(Format.ASSEMBLY_FILE_FORMAT)) { // Leave is as it is + // Allow submitter accession to be provided on the ID line. + addBlockReader(new IDReader(lineReader, true)); + addSkipTagCounterHolder(new ACReader(lineReader)); + addSkipTagCounterHolder(new PRReader(lineReader)); + addSkipTagCounterHolder(new DEReader(lineReader)); + addSkipTagCounterHolder(new KWReader(lineReader)); + addSkipTagCounterHolder(new DTReader(lineReader)); + addBlockReader(new ACStarReader(lineReader)); + addSkipTagCounterHolder(new STStarReader(lineReader)); + addBlockReader(new COReader(lineReader)); + addBlockReader(new SQReader(lineReader)); + addBlockReader(new AHReader(lineReader)); + addBlockReader(new FHReader(lineReader)); + addSkipTagCounterHolder(new CCReader(lineReader)); + addSkipTagCounterHolder(new DRReader(lineReader)); + addSkipTagCounterHolder(new OSReader(lineReader)); + addSkipTagCounterHolder(new OCReader(lineReader)); + addSkipTagCounterHolder(new OGReader(lineReader)); + addBlockReader(new ASReader(lineReader)); + addSkipTagCounterHolder(new RAReader(lineReader)); + addSkipTagCounterHolder(new RCReader(lineReader)); + addSkipTagCounterHolder(new RGReader(lineReader)); + addSkipTagCounterHolder(new RLReader(lineReader)); + addSkipTagCounterHolder(new RNReader(lineReader)); + addSkipTagCounterHolder(new RPReader(lineReader)); + addSkipTagCounterHolder(new RTReader(lineReader)); + addSkipTagCounterHolder(new RXReader(lineReader)); + skipSourceFeature = true; + } + + /** + * Have to add the line types separately as are not registered with the main hash of readers. + */ + getBlockCounter().put(EmblTag.FT_TAG, 0); + + if (!format.equals(Format.MASTER_FORMAT)) { + getBlockCounter().put(EmblTag.SQ_TAG, 0); + } + } + @Override protected boolean readFeature(LineReader lineReader, Entry entry) throws IOException { diff --git a/src/test/java/uk/ac/ebi/embl/api/validation/ValidationMessageTest.java b/src/test/java/uk/ac/ebi/embl/api/validation/ValidationMessageTest.java index 11679205..6065aaf2 100644 --- a/src/test/java/uk/ac/ebi/embl/api/validation/ValidationMessageTest.java +++ b/src/test/java/uk/ac/ebi/embl/api/validation/ValidationMessageTest.java @@ -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)); + assertTrue(ValidationScope.NCBI.isInGroup(ValidationScope.Group.PUTFF)); + + assertTrue(ValidationScope.ASSEMBLY_MASTER.isInGroup(ValidationScope.Group.ASSEMBLY)); + assertTrue(ValidationScope.ASSEMBLY_MASTER.isInGroup(ValidationScope.Group.PIPELINE)); + } } diff --git a/src/test/java/uk/ac/ebi/embl/api/validation/plan/ValidationPlanTest.java b/src/test/java/uk/ac/ebi/embl/api/validation/plan/ValidationPlanTest.java index a407ea4d..4fef7059 100644 --- a/src/test/java/uk/ac/ebi/embl/api/validation/plan/ValidationPlanTest.java +++ b/src/test/java/uk/ac/ebi/embl/api/validation/plan/ValidationPlanTest.java @@ -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() { + 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() { + 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() { + 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)); + } } diff --git a/src/test/java/uk/ac/ebi/embl/template/TemplateEntryProcessorTest.java b/src/test/java/uk/ac/ebi/embl/template/TemplateEntryProcessorTest.java index cc11a89f..3aee05b2 100644 --- a/src/test/java/uk/ac/ebi/embl/template/TemplateEntryProcessorTest.java +++ b/src/test/java/uk/ac/ebi/embl/template/TemplateEntryProcessorTest.java @@ -120,7 +120,8 @@ public void testEntryProcess_ERT000002() throws Exception { // Test with invalid taxid expectedException.expect(TaxonomyException.class); - expectedException.expectMessage("Error while calling the url: https://www.ebi.ac.uk/ena/taxonomy/rest/tax-id/960600000000"); + expectedException.expectMessage( + "Error while calling the url: https://www.ebi.ac.uk/ena/taxonomy/rest/tax-id/960600000000"); templateVariables = getTemplateVariables_ERT000002("960600000000"); executeEntryProcessInvalidTaxId( "960600000000", templateInfo_ERT000002, molType_ERT000002, templateVariables); @@ -168,7 +169,8 @@ public void testEntryProcess_ERT000056() throws Exception { // Test with invalid taxid expectedException.expect(TaxonomyException.class); - expectedException.expectMessage("Error while calling the url: https://www.ebi.ac.uk/ena/taxonomy/rest/tax-id/960600000000"); + expectedException.expectMessage( + "Error while calling the url: https://www.ebi.ac.uk/ena/taxonomy/rest/tax-id/960600000000"); templateVariables = getTemplateVariables_ERT000056("960600000000"); executeEntryProcessInvalidTaxId( "960600000000", templateInfo_ERT000056, molType_ERT000056, templateVariables);