-
Notifications
You must be signed in to change notification settings - Fork 86
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
[3654] Add parameter types to individuals. #263
[3654] Add parameter types to individuals. #263
Conversation
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.
home/src/main/resources/rdf/abox/filegraph/dynamic-api-individuals.n3
Outdated
Show resolved
Hide resolved
<https://vivoweb.org/ontology/vitro-dynamic-api/parameter/type/XSDindividual> | ||
a dynapi:parameterType , | ||
dynapi_java:ParameterType ; | ||
dynapi:typeName "individual" ; | ||
rdfs:label "Individual type"@en-US ; | ||
vitro:mostSpecificType dynapi:parameterType . |
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.
Not sure whether we will need separated parameter types for researchers, organizations, etc., or this generic one will be enough. @litvinovg any opinion on this?
The validators are being handled via a different branch and respective commits.
…b.com> Co-authored-by: Kevin Day <kday@library.tamu.edu> Co-authored-by: Georgy Litvinov <git@litvinovg.pro> Co-authored-by: Dragan Ivanovic <chenejac@uns.ac.rs> Co-authored-by: Veljko Maksimovic <maxi.maksimovic7@gmail.com> Co-authored-by: Dragan Ivanovic <dragan.ivanovic@uns.ac.rs> Added action pool tests Test action pool thread safety Merge pull request vivo-project#254 from wwelling/dynapi-action-pool-tests Dynic API Action Pool Tests fix: improved thread safety in action pool Add RPC Endpoint tests using PowerMock Merge pull request vivo-project#256 from litvinovg/action-pool-thread-safety Improved thread safety in action pool Merge branch 'sprint-dynapi-2022-feb-staging' into dynapi-rpc_endpoint_test-testing_staging Fix RPC Endpoint test to actual test against RPC Endpoint and not REST Endpoint. The static mocks must be recreated on each run or tests will fail (probably due to the design ramifications of SimpleMock). Most of the mocks had to be converted into static variables. To make sure that the action.run() is actually called by explicitly calling verify(). The staging branch is merged into this branch to accommodate breaking changes. Merge pull request vivo-project#257 from kaladay/dynapi-rpc_endpoint_test Add RPC Endpoint tests using PowerMock DRY Generic pool (vivo-project#260) fix: reuse instances in configurationBeanLoader to prevent stack overflow while instantiating rdf which contain loops fix: rename customAction to customRESTAction (vivo-project#258) Add parameter types and validators to individuals. feat: improved parameter management in ontology, added operation interface to action to use as operation in future meta actions Remove added validators. The validators are being handled via a different branch and respective commits. feat: added interfaces to get required information for parameter scopes computation Afford add/remove individual component from pools (vivo-project#261) fix: indentation fixes Merge pull request vivo-project#263 from kaladay/3654-create_individuals [3654] Add parameter types to individuals. Added validators: NumericRangeValidator (min value and max value defined) RegularExpressionValidator StringLengthRangeValidator (min length and max length defined) Testing validators: NumericRangeValidator (min value and max value defined) RegularExpressionValidator StringLengthRangeValidator (min length and max length defined) adding new n3 file for testing Solr actions added refactored SPARQLQueryOperation and N3Template Merge pull request vivo-project#262 from litvinovg/configuration-bean-loader-loops fix: reuse instances in configurationBeanLoader to prevent stack over… Indentation issues resolved fix: indentation Refactored operation interface and AbstractOperation class to account for architectural changes (Templates do not provide parameters) Merge pull request vivo-project#265 from litvinovg/computing-parameter-scopes Parameter scopes computation Merge pull request vivo-project#268 from chenejac/3654_adding_validators_for_parameters [3654] adding validators for parameters fix: move stream reset inside loop so that every listener gets the same state until a better approach is implemented (copy of c3aa9c5) Merge pull request vivo-project#275 from litvinovg/fix_listeners_staging Move stream reset inside loop so that every listener gets the same state Properly handle unimplemented Methods in RPC and replace testing framework. The RPC endpoints should return 501 for the GET, PUT, and DELETE methods. The tests are updated to handle this. Using EasyMock continued to be enough problems that I feel that it is necessary to replace EasyMock (and the recently added PowerMock) with Mockito. Mockito allows for much cleaner test writing and provides a more stable API. The other projects depending on EasyMock either use it in very few ways or are using it when they should instead be using JUnit (specifically the JUnit assertions). Switch from formal mock to informal mock (a stub). Utilize OperationResult.notImplemented() rather than directly setting status. Improve parsing of URI to get action name and enhance existing tests. Existing tests now perform additional checks to ensure the expected status code is returned. Merge pull request vivo-project#276 from kaladay/dynapi-rpc_endpoint-http_methods Properly handle unimplemented Methods in RPC and replace testing framework. Refactored and activated one test that was previously ignored Merge branch 'sprint-dynapi-2022-feb-staging' into solr_operation [3651] Generic pool key - Versioned Resource Pool (vivo-project#271) * pool generic key * pool test refactor and cleanup * rearrange pool generics * add resource key with version * resource pool with versioning * ensure version requested does not exceed resource version max * minor test cleanup * add each REST verb for all test resources * simplify resource key versioning affording latest of specific version at major and minor * improved versioning support and comprehensive tests with more meaningful test n3 * minor n3 formatting * cleanup abstract pool * versioned abstract pool to extend abstract pool New Solr Ontology and solr test individuals added fixed merging mistake with vitro ontology Rewrote SolrQuery to implement new interfaces and work with new search RDF properties instead of JSON objects. Wrote more tests, and swapped EasyMock for Mockito Fixed test problem with MockedStatic Created individuals and changed ontology to reflect new properties added to SolrQuery operation Removed unused gson maven dependency Removed AbstractOperation & AbstractQuery classes that are no loinger needed [3678] Implement integration testing for RPC Endpoints. The goal here is to mock as little as possible and to test on what goes and and what comes out of the endpoint. Because the data is auto-loaded (via `ConfigurationBeanLoader` in `ServletContextTest`) from the RDF data, the QueryExecutionFactory itself is mocked. This operates on the assumption that the RDF is executing a SPARQL query. The SPARQL query should not run for the purposes of this test and is instead mocked. Every other aspect of this testing process avoids mocking as much as possible. Avoid `@RunWith(MockitoJUnitRunner.class)` and the mocking annotations so that paremeterized tests can be used. (Junit5 would be a boon here, given that Junit4 doesn't support multiple simultaneously runners.) A significant amount of code is reduced by utilizing parameterized testing. This has a downside of requiring certain framework to be in place (and Junit4 has notable limitations in this regard). The testing data is defined within the `requests()` method and is written using a custom styling that makes the parameters easier to understand and modify. The GET, PUT, and DELETE endpoints should always return 501 (Not Implemented). By utilizing the parameter testing, these testing process ensures that even if the Request paremters are different, the 501 is always returned. The POST endpoint handles the specific endpoints. I would note that a 500 is returned for validation failures, but wouldn't these be better suited to being 400 (Bad Request)s? Found and fixed a problem in `dynamic-api-individuals-testing.n3` where `testParam2` most likely should be referring to 'email' rather than 'limit'. Using a spy() is not needed in this case. Use the `@Parameter` annotation instead of a constructor. This simplifies some of the logic at the cost of requiring the variables to be public. rest endpoint implementation Relocate hardcoded json mock data to a static file. Merge pull request vivo-project#277 from wwelling/3667-rest-endpoint [3667] REST endpoint implementation Merge remote-tracking branch 'origin/sprint-dynapi-2022-feb-staging' into dynapi-rpc_endpoint_it Moved test.n3 to src/testresources and wrote test for query loading Merge branch 'sprint-dynapi-2022-feb-staging' into solr_operation Trivial merge conflict resolved fixed ontology, test .n3 and formatting mistakes naming merge conflict fixed naming merge conflict fixed Merge pull request vivo-project#272 from VeljkoMaksimovic/solr_operation Solr operation [3678] Improve endpoints to be more flexible and replace stub servlets with mocking. Add testBefore and testAfter callbacks to make the design more versatile. The sparql mocking is moved into a before callback. Add comments to the parameter list table to make it more readable. Fix tabbing/spacing. Revert changes to stub. These changes are not needed for the integration testing. Revert to changes prior to integration testing modifications. Add missing trailing newline. Merge pull request vivo-project#278 from kaladay/dynapi-rpc_endpoint_it [3678] Implement integration testing for RPC Endpoints.
…b.com> Co-authored-by: Kevin Day <kday@library.tamu.edu> Co-authored-by: Georgy Litvinov <git@litvinovg.pro> Co-authored-by: Dragan Ivanovic <chenejac@uns.ac.rs> Co-authored-by: Veljko Maksimovic <maxi.maksimovic7@gmail.com> Co-authored-by: Dragan Ivanovic <dragan.ivanovic@uns.ac.rs> Added action pool tests Test action pool thread safety Merge pull request vivo-project#254 from wwelling/dynapi-action-pool-tests Dynic API Action Pool Tests fix: improved thread safety in action pool Add RPC Endpoint tests using PowerMock Merge pull request vivo-project#256 from litvinovg/action-pool-thread-safety Improved thread safety in action pool Merge branch 'sprint-dynapi-2022-feb-staging' into dynapi-rpc_endpoint_test-testing_staging Fix RPC Endpoint test to actual test against RPC Endpoint and not REST Endpoint. The static mocks must be recreated on each run or tests will fail (probably due to the design ramifications of SimpleMock). Most of the mocks had to be converted into static variables. To make sure that the action.run() is actually called by explicitly calling verify(). The staging branch is merged into this branch to accommodate breaking changes. Merge pull request vivo-project#257 from kaladay/dynapi-rpc_endpoint_test Add RPC Endpoint tests using PowerMock DRY Generic pool (vivo-project#260) fix: reuse instances in configurationBeanLoader to prevent stack overflow while instantiating rdf which contain loops fix: rename customAction to customRESTAction (vivo-project#258) Add parameter types and validators to individuals. feat: improved parameter management in ontology, added operation interface to action to use as operation in future meta actions Remove added validators. The validators are being handled via a different branch and respective commits. feat: added interfaces to get required information for parameter scopes computation Afford add/remove individual component from pools (vivo-project#261) fix: indentation fixes Merge pull request vivo-project#263 from kaladay/3654-create_individuals [3654] Add parameter types to individuals. Added validators: NumericRangeValidator (min value and max value defined) RegularExpressionValidator StringLengthRangeValidator (min length and max length defined) Testing validators: NumericRangeValidator (min value and max value defined) RegularExpressionValidator StringLengthRangeValidator (min length and max length defined) adding new n3 file for testing Solr actions added refactored SPARQLQueryOperation and N3Template Merge pull request vivo-project#262 from litvinovg/configuration-bean-loader-loops fix: reuse instances in configurationBeanLoader to prevent stack over… Indentation issues resolved fix: indentation Refactored operation interface and AbstractOperation class to account for architectural changes (Templates do not provide parameters) Merge pull request vivo-project#265 from litvinovg/computing-parameter-scopes Parameter scopes computation Merge pull request vivo-project#268 from chenejac/3654_adding_validators_for_parameters [3654] adding validators for parameters fix: move stream reset inside loop so that every listener gets the same state until a better approach is implemented (copy of c3aa9c5) Merge pull request vivo-project#275 from litvinovg/fix_listeners_staging Move stream reset inside loop so that every listener gets the same state Properly handle unimplemented Methods in RPC and replace testing framework. The RPC endpoints should return 501 for the GET, PUT, and DELETE methods. The tests are updated to handle this. Using EasyMock continued to be enough problems that I feel that it is necessary to replace EasyMock (and the recently added PowerMock) with Mockito. Mockito allows for much cleaner test writing and provides a more stable API. The other projects depending on EasyMock either use it in very few ways or are using it when they should instead be using JUnit (specifically the JUnit assertions). Switch from formal mock to informal mock (a stub). Utilize OperationResult.notImplemented() rather than directly setting status. Improve parsing of URI to get action name and enhance existing tests. Existing tests now perform additional checks to ensure the expected status code is returned. Merge pull request vivo-project#276 from kaladay/dynapi-rpc_endpoint-http_methods Properly handle unimplemented Methods in RPC and replace testing framework. Refactored and activated one test that was previously ignored Merge branch 'sprint-dynapi-2022-feb-staging' into solr_operation [3651] Generic pool key - Versioned Resource Pool (vivo-project#271) * pool generic key * pool test refactor and cleanup * rearrange pool generics * add resource key with version * resource pool with versioning * ensure version requested does not exceed resource version max * minor test cleanup * add each REST verb for all test resources * simplify resource key versioning affording latest of specific version at major and minor * improved versioning support and comprehensive tests with more meaningful test n3 * minor n3 formatting * cleanup abstract pool * versioned abstract pool to extend abstract pool New Solr Ontology and solr test individuals added fixed merging mistake with vitro ontology Rewrote SolrQuery to implement new interfaces and work with new search RDF properties instead of JSON objects. Wrote more tests, and swapped EasyMock for Mockito Fixed test problem with MockedStatic Created individuals and changed ontology to reflect new properties added to SolrQuery operation Removed unused gson maven dependency Removed AbstractOperation & AbstractQuery classes that are no loinger needed [3678] Implement integration testing for RPC Endpoints. The goal here is to mock as little as possible and to test on what goes and and what comes out of the endpoint. Because the data is auto-loaded (via `ConfigurationBeanLoader` in `ServletContextTest`) from the RDF data, the QueryExecutionFactory itself is mocked. This operates on the assumption that the RDF is executing a SPARQL query. The SPARQL query should not run for the purposes of this test and is instead mocked. Every other aspect of this testing process avoids mocking as much as possible. Avoid `@RunWith(MockitoJUnitRunner.class)` and the mocking annotations so that paremeterized tests can be used. (Junit5 would be a boon here, given that Junit4 doesn't support multiple simultaneously runners.) A significant amount of code is reduced by utilizing parameterized testing. This has a downside of requiring certain framework to be in place (and Junit4 has notable limitations in this regard). The testing data is defined within the `requests()` method and is written using a custom styling that makes the parameters easier to understand and modify. The GET, PUT, and DELETE endpoints should always return 501 (Not Implemented). By utilizing the parameter testing, these testing process ensures that even if the Request paremters are different, the 501 is always returned. The POST endpoint handles the specific endpoints. I would note that a 500 is returned for validation failures, but wouldn't these be better suited to being 400 (Bad Request)s? Found and fixed a problem in `dynamic-api-individuals-testing.n3` where `testParam2` most likely should be referring to 'email' rather than 'limit'. Using a spy() is not needed in this case. Use the `@Parameter` annotation instead of a constructor. This simplifies some of the logic at the cost of requiring the variables to be public. rest endpoint implementation Relocate hardcoded json mock data to a static file. Merge pull request vivo-project#277 from wwelling/3667-rest-endpoint [3667] REST endpoint implementation Merge remote-tracking branch 'origin/sprint-dynapi-2022-feb-staging' into dynapi-rpc_endpoint_it Moved test.n3 to src/testresources and wrote test for query loading Merge branch 'sprint-dynapi-2022-feb-staging' into solr_operation Trivial merge conflict resolved fixed ontology, test .n3 and formatting mistakes naming merge conflict fixed naming merge conflict fixed Merge pull request vivo-project#272 from VeljkoMaksimovic/solr_operation Solr operation [3678] Improve endpoints to be more flexible and replace stub servlets with mocking. Add testBefore and testAfter callbacks to make the design more versatile. The sparql mocking is moved into a before callback. Add comments to the parameter list table to make it more readable. Fix tabbing/spacing. Revert changes to stub. These changes are not needed for the integration testing. Revert to changes prior to integration testing modifications. Add missing trailing newline. Merge pull request vivo-project#278 from kaladay/dynapi-rpc_endpoint_it [3678] Implement integration testing for RPC Endpoints.
…b.com> Co-authored-by: Kevin Day <kday@library.tamu.edu> Co-authored-by: Georgy Litvinov <git@litvinovg.pro> Co-authored-by: Dragan Ivanovic <chenejac@uns.ac.rs> Co-authored-by: Veljko Maksimovic <maxi.maksimovic7@gmail.com> Co-authored-by: Dragan Ivanovic <dragan.ivanovic@uns.ac.rs> Added action pool tests Test action pool thread safety Merge pull request vivo-project#254 from wwelling/dynapi-action-pool-tests Dynic API Action Pool Tests fix: improved thread safety in action pool Add RPC Endpoint tests using PowerMock Merge pull request vivo-project#256 from litvinovg/action-pool-thread-safety Improved thread safety in action pool Merge branch 'sprint-dynapi-2022-feb-staging' into dynapi-rpc_endpoint_test-testing_staging Fix RPC Endpoint test to actual test against RPC Endpoint and not REST Endpoint. The static mocks must be recreated on each run or tests will fail (probably due to the design ramifications of SimpleMock). Most of the mocks had to be converted into static variables. To make sure that the action.run() is actually called by explicitly calling verify(). The staging branch is merged into this branch to accommodate breaking changes. Merge pull request vivo-project#257 from kaladay/dynapi-rpc_endpoint_test Add RPC Endpoint tests using PowerMock DRY Generic pool (vivo-project#260) fix: reuse instances in configurationBeanLoader to prevent stack overflow while instantiating rdf which contain loops fix: rename customAction to customRESTAction (vivo-project#258) Add parameter types and validators to individuals. feat: improved parameter management in ontology, added operation interface to action to use as operation in future meta actions Remove added validators. The validators are being handled via a different branch and respective commits. feat: added interfaces to get required information for parameter scopes computation Afford add/remove individual component from pools (vivo-project#261) fix: indentation fixes Merge pull request vivo-project#263 from kaladay/3654-create_individuals [3654] Add parameter types to individuals. Added validators: NumericRangeValidator (min value and max value defined) RegularExpressionValidator StringLengthRangeValidator (min length and max length defined) Testing validators: NumericRangeValidator (min value and max value defined) RegularExpressionValidator StringLengthRangeValidator (min length and max length defined) adding new n3 file for testing Solr actions added refactored SPARQLQueryOperation and N3Template Merge pull request vivo-project#262 from litvinovg/configuration-bean-loader-loops fix: reuse instances in configurationBeanLoader to prevent stack over… Indentation issues resolved fix: indentation Refactored operation interface and AbstractOperation class to account for architectural changes (Templates do not provide parameters) Merge pull request vivo-project#265 from litvinovg/computing-parameter-scopes Parameter scopes computation Merge pull request vivo-project#268 from chenejac/3654_adding_validators_for_parameters [3654] adding validators for parameters fix: move stream reset inside loop so that every listener gets the same state until a better approach is implemented (copy of c3aa9c5) Merge pull request vivo-project#275 from litvinovg/fix_listeners_staging Move stream reset inside loop so that every listener gets the same state Properly handle unimplemented Methods in RPC and replace testing framework. The RPC endpoints should return 501 for the GET, PUT, and DELETE methods. The tests are updated to handle this. Using EasyMock continued to be enough problems that I feel that it is necessary to replace EasyMock (and the recently added PowerMock) with Mockito. Mockito allows for much cleaner test writing and provides a more stable API. The other projects depending on EasyMock either use it in very few ways or are using it when they should instead be using JUnit (specifically the JUnit assertions). Switch from formal mock to informal mock (a stub). Utilize OperationResult.notImplemented() rather than directly setting status. Improve parsing of URI to get action name and enhance existing tests. Existing tests now perform additional checks to ensure the expected status code is returned. Merge pull request vivo-project#276 from kaladay/dynapi-rpc_endpoint-http_methods Properly handle unimplemented Methods in RPC and replace testing framework. Refactored and activated one test that was previously ignored Merge branch 'sprint-dynapi-2022-feb-staging' into solr_operation [3651] Generic pool key - Versioned Resource Pool (vivo-project#271) * pool generic key * pool test refactor and cleanup * rearrange pool generics * add resource key with version * resource pool with versioning * ensure version requested does not exceed resource version max * minor test cleanup * add each REST verb for all test resources * simplify resource key versioning affording latest of specific version at major and minor * improved versioning support and comprehensive tests with more meaningful test n3 * minor n3 formatting * cleanup abstract pool * versioned abstract pool to extend abstract pool New Solr Ontology and solr test individuals added fixed merging mistake with vitro ontology Rewrote SolrQuery to implement new interfaces and work with new search RDF properties instead of JSON objects. Wrote more tests, and swapped EasyMock for Mockito Fixed test problem with MockedStatic Created individuals and changed ontology to reflect new properties added to SolrQuery operation Removed unused gson maven dependency Removed AbstractOperation & AbstractQuery classes that are no loinger needed [3678] Implement integration testing for RPC Endpoints. The goal here is to mock as little as possible and to test on what goes and and what comes out of the endpoint. Because the data is auto-loaded (via `ConfigurationBeanLoader` in `ServletContextTest`) from the RDF data, the QueryExecutionFactory itself is mocked. This operates on the assumption that the RDF is executing a SPARQL query. The SPARQL query should not run for the purposes of this test and is instead mocked. Every other aspect of this testing process avoids mocking as much as possible. Avoid `@RunWith(MockitoJUnitRunner.class)` and the mocking annotations so that paremeterized tests can be used. (Junit5 would be a boon here, given that Junit4 doesn't support multiple simultaneously runners.) A significant amount of code is reduced by utilizing parameterized testing. This has a downside of requiring certain framework to be in place (and Junit4 has notable limitations in this regard). The testing data is defined within the `requests()` method and is written using a custom styling that makes the parameters easier to understand and modify. The GET, PUT, and DELETE endpoints should always return 501 (Not Implemented). By utilizing the parameter testing, these testing process ensures that even if the Request paremters are different, the 501 is always returned. The POST endpoint handles the specific endpoints. I would note that a 500 is returned for validation failures, but wouldn't these be better suited to being 400 (Bad Request)s? Found and fixed a problem in `dynamic-api-individuals-testing.n3` where `testParam2` most likely should be referring to 'email' rather than 'limit'. Using a spy() is not needed in this case. Use the `@Parameter` annotation instead of a constructor. This simplifies some of the logic at the cost of requiring the variables to be public. rest endpoint implementation Relocate hardcoded json mock data to a static file. Merge pull request vivo-project#277 from wwelling/3667-rest-endpoint [3667] REST endpoint implementation Merge remote-tracking branch 'origin/sprint-dynapi-2022-feb-staging' into dynapi-rpc_endpoint_it Moved test.n3 to src/testresources and wrote test for query loading Merge branch 'sprint-dynapi-2022-feb-staging' into solr_operation Trivial merge conflict resolved fixed ontology, test .n3 and formatting mistakes naming merge conflict fixed naming merge conflict fixed Merge pull request vivo-project#272 from VeljkoMaksimovic/solr_operation Solr operation [3678] Improve endpoints to be more flexible and replace stub servlets with mocking. Add testBefore and testAfter callbacks to make the design more versatile. The sparql mocking is moved into a before callback. Add comments to the parameter list table to make it more readable. Fix tabbing/spacing. Revert changes to stub. These changes are not needed for the integration testing. Revert to changes prior to integration testing modifications. Add missing trailing newline. Merge pull request vivo-project#278 from kaladay/dynapi-rpc_endpoint_it [3678] Implement integration testing for RPC Endpoints.
VIVO GitHub issue 3654:
What does this pull request do?
Add additional Parameter Types and Validators to the dynamic-api-individuals.n3 file.
What's new?
How should this be tested?
A description of what steps someone could take to:
Additional Notes:
Should specific Individual types be created, such as: XSDResearcher, XSDOrganization, XSDProject, XSDPublication?
Interested parties
Tag (@ mention) interested parties or, if unsure, @VIVO-project/vivo-committers