-
Notifications
You must be signed in to change notification settings - Fork 1
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
Pivotal ID # 177267343: Validate EU-ToxRisk Submissions #352
Merged
jhoanmanuelms
merged 4 commits into
master
from
feature/pivotal-177267343-validate-eu-toxrisk
Mar 20, 2021
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7b1cd4d
Pivotal ID # 177267343: Validate EU-ToxRisk Submissions
jhoanmanuelms c126c23
Pivotal ID # 177267343: Validate EU-ToxRisk Submissions
jhoanmanuelms 3f525d7
Merge branch 'master' into feature/pivotal-177267343-validate-eu-toxrisk
jhoanmanuelms d72f141
Pivotal ID # 177267343: Validate EU-ToxRisk Submissions
jhoanmanuelms 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 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 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 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 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 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
50 changes: 50 additions & 0 deletions
50
...-model-extended-mapping/src/test/kotlin/ebi/ac/uk/extended/mapping/to/ToSubmissionTest.kt
This file contains 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package ebi.ac.uk.extended.mapping.to | ||
|
||
import ebi.ac.uk.extended.model.ExtAttribute | ||
import ebi.ac.uk.extended.model.ExtCollection | ||
import ebi.ac.uk.model.Attribute | ||
import ebi.ac.uk.model.Submission | ||
import ebi.ac.uk.model.extensions.attachTo | ||
import ebi.ac.uk.model.extensions.releaseDate | ||
import ebi.ac.uk.model.extensions.rootPath | ||
import ebi.ac.uk.model.extensions.title | ||
import ebi.ac.uk.test.basicExtSubmission | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import java.time.OffsetDateTime | ||
import java.time.ZoneOffset.UTC | ||
|
||
class ToSubmissionTest { | ||
private val extSubmission = basicExtSubmission.copy( | ||
rootPath = "/a/root/path", | ||
collections = listOf(ExtCollection("BioImages")), | ||
releaseTime = OffsetDateTime.of(2019, 9, 21, 0, 0, 0, 0, UTC), | ||
attributes = listOf( | ||
ExtAttribute("Type", "Experiment"), | ||
ExtAttribute("CollectionValidator", "BioImagesValidator"))) | ||
|
||
@Test | ||
fun toSimpleSubmission() { | ||
val submission = extSubmission.toSimpleSubmission() | ||
assertThat(submission.accNo).isEqualTo("S-TEST123") | ||
assertSection(submission) | ||
assertSubmissionAttributes(submission) | ||
} | ||
|
||
private fun assertSection(submission: Submission) { | ||
assertThat(submission.section.type).isEqualTo("Study") | ||
assertThat(submission.section.attributes).isEmpty() | ||
assertThat(submission.section.files).isEmpty() | ||
assertThat(submission.section.links).isEmpty() | ||
assertThat(submission.section.sections).isEmpty() | ||
} | ||
|
||
private fun assertSubmissionAttributes(submission: Submission) { | ||
assertThat(submission.attributes).hasSize(5) | ||
assertThat(submission.attributes).contains(Attribute("Type", "Experiment")) | ||
assertThat(submission.title).isEqualTo("Test Submission") | ||
assertThat(submission.attachTo).isEqualTo("BioImages") | ||
assertThat(submission.releaseDate).isEqualTo("2019-09-21") | ||
assertThat(submission.rootPath).isEqualTo("/a/root/path") | ||
} | ||
} |
This file contains 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 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
29 changes: 29 additions & 0 deletions
29
commons/commons-test/src/main/kotlin/ebi/ac/uk/test/ExtSubmissionFactory.kt
This file contains 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package ebi.ac.uk.test | ||
|
||
import ebi.ac.uk.extended.model.ExtProcessingStatus.PROCESSED | ||
import ebi.ac.uk.extended.model.ExtSection | ||
import ebi.ac.uk.extended.model.ExtSubmission | ||
import ebi.ac.uk.extended.model.ExtSubmissionMethod.PAGE_TAB | ||
import java.time.OffsetDateTime | ||
import java.time.ZoneOffset.UTC | ||
|
||
val basicExtSubmission = ExtSubmission( | ||
accNo = "S-TEST123", | ||
version = 1, | ||
title = "Test Submission", | ||
owner = "owner@email.org", | ||
submitter = "submitter@email.org", | ||
method = PAGE_TAB, | ||
relPath = "S-TEST/123/S-TEST123", | ||
rootPath = null, | ||
released = false, | ||
secretKey = "a-secret-key", | ||
status = PROCESSED, | ||
releaseTime = null, | ||
modificationTime = OffsetDateTime.of(2018, 9, 21, 0, 0, 0, 0, UTC), | ||
creationTime = OffsetDateTime.of(2018, 9, 21, 0, 0, 0, 0, UTC), | ||
attributes = emptyList(), | ||
tags = emptyList(), | ||
collections = emptyList(), | ||
section = ExtSection(type = "Study") | ||
) |
This file contains 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 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 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 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 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 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
Oops, something went wrong.
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.
we have create many of this, eventually we will need to put in common and use the same one
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.
That's actually what I did with this change. I placed this one in commons-test and used it from everywhere else