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

Pivotal ID # 177267343: Validate EU-ToxRisk Submissions #352

Merged
merged 4 commits into from
Mar 20, 2021

Conversation

jhoanmanuelms
Copy link
Contributor

https://www.pivotaltracker.com/story/show/177267343

  • Implement collection validators
  • Update the submission submitter to use them

Delivers # 177267343

- Implement collection validators
- Update the submission submitter to use them
@jhoanmanuelms jhoanmanuelms requested a review from Juan-EBI March 16, 2021 15:46
@jhoanmanuelms jhoanmanuelms self-assigned this Mar 16, 2021
@@ -18,11 +22,14 @@ fun ExtSubmission.toSimpleSubmission(): Submission = Submission(
)

private fun ExtSubmission.getSubmissionAttributes(): List<Attribute> {
val subAttrs = attributes.map { it.toAttribute() }.toMutableSet()
val subAttrs =
Copy link
Contributor

@Juan-EBI Juan-EBI Mar 17, 2021

Choose a reason for hiding this comment

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

why are we filtering it here? I was expecting when transforming to simple submission

Copy link
Contributor Author

@jhoanmanuelms jhoanmanuelms Mar 17, 2021

Choose a reason for hiding this comment

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

This method comes from toSimpleSubmission (check line 16)

- Code review comments
- Unit and integration testing
@jhoanmanuelms jhoanmanuelms marked this pull request as ready for review March 20, 2021 00:19
@@ -18,11 +21,14 @@ fun ExtSubmission.toSimpleSubmission(): Submission = Submission(
)

private fun ExtSubmission.getSubmissionAttributes(): List<Attribute> {
val subAttrs = attributes.map { it.toAttribute() }.toMutableSet()
val subAttrs =
attributes
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should create a private method getpageTabAttributes to make clear why we remove the validator.

import java.time.OffsetDateTime
import java.time.ZoneOffset.UTC

val basicExtSubmission = ExtSubmission(
Copy link
Contributor

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

Copy link
Contributor Author

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


private fun collectionInfo(accNo: String) = queryService.getBasicCollection(accNo)

private fun validate(validator: String, submission: ExtSubmission) =
Copy link
Contributor

Choose a reason for hiding this comment

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

this method is not doing what is said that is does making logic harder to follow, it does not validate but it gets the validation bean and validate (it is also doing to two operations and not a single one)

val requestSlot = slot<HttpEntity<FileSystemResource>>()

every {
restTemplate.postForObject(testUrl, capture(requestSlot), EuToxRiskValidatorResponse::class.java)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can use .postForObject<EuToxRiskValidatorResponse can not we? as in the normal code.

}

private fun setUpRestTemplate(response: EuToxRiskValidatorResponse): CapturingSlot<HttpEntity<FileSystemResource>> {
val requestSlot = slot<HttpEntity<FileSystemResource>>()
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should declare this as a field and in each test:

  every {  restTemplate.postForObject<>(testUrl, capture(requestSlot)) } } returns response

I think way when one is reviewing the test does not need to check what setUpRestTemplate does as the setup is part of each test. Also I think we do not need type I think compiler with infer it.

Copy link
Contributor

@Juan-EBI Juan-EBI left a comment

Choose a reason for hiding this comment

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

LGTM please check comments before merge

@jhoanmanuelms jhoanmanuelms merged commit d021316 into master Mar 20, 2021
@jhoanmanuelms jhoanmanuelms deleted the feature/pivotal-177267343-validate-eu-toxrisk branch March 20, 2021 17:37
jhoanmanuelms added a commit that referenced this pull request Mar 20, 2021
Feature
* Pivotal ID # 176052254: JSON Submission Attributes Validation (#310)
* Pivotal #ID:175163839: Submission Query Operations In Mongo (#319)
* Pivotal-176168841: Allow to check inactive user registration (#315)
* Pivotal ID # 176522202: Ext Submission serialization (#322)
* Pivotal ID # 172671360: Warn users about upcoming public release (#324)
* Pivotal #ID 176479707: Mongo implement draft funtionality (#327)
* Pivotal #ID 176479720: Mongo Metadata Query (#328)
* Pivotal ID # 175163839: Mongo Submission Stats (#331)
* Pivotal ID # 176886357: Async Submission Request (#334)
* Pivotal ID # 176977556: Delete Submissions In Mongo (#341)
* Pivotal ID #176679139: Ext Submission File List Refactor (#344)
* Pivotal ID # 177042374: Delete Draft After Submission (#349)
* Pivotal ID# 174948695: PTSubmit Delete Operation (#351)
* Pivotal #ID 177076728: Use PMC new streaming API (#346)
* Pivotal ID # 177267343: Validate EU-ToxRisk Submissions (#352)

Bugfix
* Pivotal ID # 176052264: Inner Folder Mapping (#311)
* Pivotal ID # 172671360: Ignore Empty Value Attributes (#314)
* Pivotal ID # 176377632: File list extension is missing in BIA studies (#321)
* Pivotal #ID 174642598: TSV Double Quotes (#350)
* Pivotal ID # 176501169: FTP Folders Missing (#335)

Chore
* Pivotal ID # 176377544: Add refresh users directory structure api endpoint (#320)
* Pivotal #ID 176479473:  Migrate biostudies test to TestContainers (#323)
* Pivotal ID # 176779952: Mongo iTests CI (#332)
* Pivotal #Id 176838189: Rename PMC mongo collections (#333)
* Pivotal #ID: 177040448: Store request as plain json (#336)
* Pivotal ID #175894089: Check if queues in RabbitMQ are persistent (#339)
* Pivotal ID #177074116 : model table section properly (#338)
* Pivotal ID # 176886824: Improve API Docs (#337)
* Pivotal #ID 177193125: Improve collection template validation (#345)

Co-authored-by: Juan <jcamilorada@ebi.ac.uk>
jhoanmanuelms added a commit that referenced this pull request Mar 21, 2021
Feature
* Pivotal ID # 176052254: JSON Submission Attributes Validation (#310)
* Pivotal #ID:175163839: Submission Query Operations In Mongo (#319)
* Pivotal-176168841: Allow to check inactive user registration (#315)
* Pivotal ID # 176522202: Ext Submission serialization (#322)
* Pivotal ID # 172671360: Warn users about upcoming public release (#324)
* Pivotal #ID 176479707: Mongo implement draft funtionality (#327)
* Pivotal #ID 176479720: Mongo Metadata Query (#328)
* Pivotal ID # 175163839: Mongo Submission Stats (#331)
* Pivotal ID # 176886357: Async Submission Request (#334)
* Pivotal ID # 176977556: Delete Submissions In Mongo (#341)
* Pivotal ID #176679139: Ext Submission File List Refactor (#344)
* Pivotal ID # 177042374: Delete Draft After Submission (#349)
* Pivotal ID# 174948695: PTSubmit Delete Operation (#351)
* Pivotal #ID 177076728: Use PMC new streaming API (#346)
* Pivotal ID # 177267343: Validate EU-ToxRisk Submissions (#352)

Bugfix
* Pivotal ID # 176052264: Inner Folder Mapping (#311)
* Pivotal ID # 172671360: Ignore Empty Value Attributes (#314)
* Pivotal ID # 176377632: File list extension is missing in BIA studies (#321)
* Pivotal #ID 174642598: TSV Double Quotes (#350)
* Pivotal ID # 176501169: FTP Folders Missing (#335)

Chore
* Pivotal ID # 176377544: Add refresh users directory structure api endpoint (#320)
* Pivotal #ID 176479473:  Migrate biostudies test to TestContainers (#323)
* Pivotal ID # 176779952: Mongo iTests CI (#332)
* Pivotal #Id 176838189: Rename PMC mongo collections (#333)
* Pivotal #ID: 177040448: Store request as plain json (#336)
* Pivotal ID #175894089: Check if queues in RabbitMQ are persistent (#339)
* Pivotal ID #177074116 : model table section properly (#338)
* Pivotal ID # 176886824: Improve API Docs (#337)
* Pivotal #ID 177193125: Improve collection template validation (#345)

Co-authored-by: Juan <jcamilorada@ebi.ac.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants