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

createing a dataset for PersonalServiceTest class #1330

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

josephbate
Copy link
Contributor

@josephbate josephbate commented Nov 27, 2024

Pull Requests Requirements

  • The PR title includes a brief description of the work done, including the
    Issue number if applicable.
  • The PR includes a video showing the changes for the work done.
  • The PR title follows conventional commit label standards.
  • The changes confirm to the OpenElis Global x3 Styleguide and design
    documentation.
  • The changes include tests or are validated by existing tests.
  • I have read and agree to the Contributing Guidelines of this project.

Summary

created a person.xml to preload data in the test enviroment to be used for testing

  • however @mozzy11 @mherman22 i have follow quite som challenges making CRUD test operation on this service since inheriting the dbunit library
  • methods like create person, update person and delete person (which are commented out) tend to give off errors and exceptions as seen in the logs; https://pastebin.com/bQ3KtRi2, https://pastebin.com/fKAAH5Bj,
  • the insert /save method for some reason assigns any intial saved person with id "2" as a default generated id, each time you try to create a person. thus this lead to duplication which brings the persitance to a halt. that simply means that if we pre-load data in the test environment we cannot Test CRUD methods against the service in this case personService

i also faced an another challenge with the createPersonWithMultiplePatients_shouldLinkPatientsToPerson() since crud is a bit of a challenge we cannot create a person to assign patient so i tried assigning from the data set but that seem also a challenge here are the error logs; https://pastebin.com/GBfFnqVy

@mozzy11 @mherman22 please do advise on this issue
thank you

Screenshots

[Add relevant screenshots here if applicable]

Related Issue

[Add a link to the related issue or mention it here if applicable]

Other

[Add any additional information or notes here]

@mherman22
Copy link
Contributor

@josephbate uncomment the commented stuff so that we can see the behaviour on ci. Also fix fomatting

Copy link
Contributor

@mherman22 mherman22 left a comment

Choose a reason for hiding this comment

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

the insert /save method for some reason assigns any intial saved person with id "2" as a default generated id, each time you try to create a person. thus this lead to duplication which brings the persitance to a halt. that simply means that if we pre-load data in the test environment we cannot Test CRUD methods against the service in this case personService

we need to create a resetSequence method that connects to the database using a DataSource and queries for the maximum value of a specified column in a table. Then, use the PostgreSQL setval function to update the sequence to maxId + 1, ensuring the sequence aligns with existing data. This has alot to do with how OpenELIS handles ID generation using a custom StringSequenceGenerator that generates and then converts the Long ID to StringFormat.

The StringSequenceGenerator generates numeric IDs but formats them as strings, and when records are deleted or modified, the sequence might fall out of sync with the actual maximum ID value in the table.

cc: @josephbate @mozzy11

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