-
Notifications
You must be signed in to change notification settings - Fork 157
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
Add configuration property defaultPageSize #2235
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
56 changes: 56 additions & 0 deletions
56
fhir-persistence/src/test/java/com/ibm/fhir/persistence/FHIRPersistenceFactoryTest.java
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,56 @@ | ||
/* | ||
* (C) Copyright IBM Corp. 2021, 2021 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ibm.fhir.persistence; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
|
||
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
import com.ibm.fhir.config.FHIRConfiguration; | ||
import com.ibm.fhir.config.FHIRRequestContext; | ||
import com.ibm.fhir.core.FHIRConstants; | ||
import com.ibm.fhir.exception.FHIRException; | ||
import com.ibm.fhir.persistence.context.FHIRHistoryContext; | ||
import com.ibm.fhir.persistence.context.FHIRPersistenceContextFactory; | ||
import com.ibm.fhir.search.SearchConstants; | ||
|
||
public class FHIRPersistenceFactoryTest { | ||
@BeforeClass | ||
public void setUpBeforeClass() { | ||
FHIRConfiguration.setConfigHome("target/test-classes"); | ||
} | ||
|
||
@BeforeMethod | ||
@AfterMethod | ||
public void clearThreadLocal() { | ||
FHIRRequestContext.remove(); | ||
} | ||
|
||
@Test | ||
public void testCreateWithDefaultPageSize() throws Exception { | ||
runCreateTest("default", FHIRConstants.FHIR_PAGE_SIZE_DEFAULT); | ||
} | ||
|
||
@Test | ||
public void testCreateWithUserConfiguredPageSize() throws Exception { | ||
runCreateTest("pagesize-valid", 500); | ||
} | ||
|
||
@Test | ||
public void testCreateWithUserConfiguredPageSizeBeyondMaxium() throws Exception { | ||
runCreateTest("pagesize-invalid", SearchConstants.MAX_PAGE_SIZE); | ||
} | ||
|
||
private void runCreateTest(String tenantId, int expectedPageSize) throws FHIRException { | ||
FHIRRequestContext.set(new FHIRRequestContext(tenantId)); | ||
FHIRHistoryContext ctx = FHIRPersistenceContextFactory.createHistoryContext(); | ||
assertEquals (ctx.getPageSize(), expectedPageSize); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
fhir-persistence/src/test/resources/config/pagesize-invalid/fhir-server-config.json
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,10 @@ | ||
{ | ||
"fhirServer": { | ||
"core": { | ||
"defaultPageSize": 5000 | ||
}, | ||
"persistence": { | ||
"factoryClassname": "com.ibm.fhir.persistence.test.MockPersistenceFactory" | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
fhir-persistence/src/test/resources/config/pagesize-valid/fhir-server-config.json
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,10 @@ | ||
{ | ||
"fhirServer": { | ||
"core": { | ||
"defaultPageSize": 500 | ||
}, | ||
"persistence": { | ||
"factoryClassname": "com.ibm.fhir.persistence.test.MockPersistenceFactory" | ||
} | ||
} | ||
} |
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
54 changes: 54 additions & 0 deletions
54
fhir-search/src/test/java/com/ibm/fhir/search/context/FHIRSearchContextFactoryTest.java
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,54 @@ | ||
/* | ||
* (C) Copyright IBM Corp. 2021, 2021 | ||
lmsurpre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ibm.fhir.search.context; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
|
||
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
import com.ibm.fhir.config.FHIRConfiguration; | ||
import com.ibm.fhir.config.FHIRRequestContext; | ||
import com.ibm.fhir.core.FHIRConstants; | ||
import com.ibm.fhir.exception.FHIRException; | ||
import com.ibm.fhir.search.SearchConstants; | ||
|
||
public class FHIRSearchContextFactoryTest { | ||
@BeforeClass | ||
public void setUpBeforeClass() { | ||
FHIRConfiguration.setConfigHome("target/test-classes"); | ||
} | ||
|
||
@BeforeMethod | ||
@AfterMethod | ||
public void clearThreadLocal() { | ||
FHIRRequestContext.remove(); | ||
} | ||
|
||
@Test | ||
public void testCreateWithDefaultPageSize() throws Exception { | ||
runCreateTest("default", FHIRConstants.FHIR_PAGE_SIZE_DEFAULT); | ||
} | ||
|
||
@Test | ||
public void testCreateWithUserConfiguredPageSize() throws Exception { | ||
runCreateTest("tenant1", 500); | ||
} | ||
|
||
@Test | ||
public void testCreateWithUserConfiguredPageSizeBeyondMaxium() throws Exception { | ||
runCreateTest("tenant2", SearchConstants.MAX_PAGE_SIZE); | ||
} | ||
|
||
private void runCreateTest(String tenantId, int expectedPageSize) throws FHIRException { | ||
FHIRRequestContext.set(new FHIRRequestContext(tenantId)); | ||
FHIRSearchContext ctx = FHIRSearchContextFactory.createSearchContext(); | ||
assertEquals (ctx.getPageSize(), expectedPageSize); | ||
} | ||
} |
59 changes: 31 additions & 28 deletions
59
fhir-search/src/test/resources/config/tenant1/fhir-server-config.json
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 |
---|---|---|
@@ -1,28 +1,31 @@ | ||
{ | ||
"__comment": "FHIR Server configuration", | ||
"fhirServer": { | ||
"resources": { | ||
"open": true, | ||
"Device": { | ||
"searchParameters": { | ||
"patient": "http://hl7.org/fhir/SearchParameter/Device-patient", | ||
"organization": "http://hl7.org/fhir/SearchParameter/Device-organization" | ||
} | ||
}, | ||
"Observation": { | ||
"searchParameters": { | ||
"code": "http://hl7.org/fhir/SearchParameter/clinical-code", | ||
"value-range": "http://hl7.org/fhir/SearchParameter/Observation-value-range" | ||
} | ||
}, | ||
"Patient": { | ||
"searchParameters": { | ||
"active": "http://hl7.org/fhir/SearchParameter/Patient-active", | ||
"address": "http://hl7.org/fhir/SearchParameter/individual-address", | ||
"birthdate": "http://hl7.org/fhir/SearchParameter/individual-birthdate", | ||
"name": "http://hl7.org/fhir/SearchParameter/Patient-name" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
{ | ||
"__comment": "FHIR Server configuration", | ||
"fhirServer": { | ||
"resources": { | ||
"open": true, | ||
"Device": { | ||
"searchParameters": { | ||
"patient": "http://hl7.org/fhir/SearchParameter/Device-patient", | ||
"organization": "http://hl7.org/fhir/SearchParameter/Device-organization" | ||
} | ||
}, | ||
"Observation": { | ||
"searchParameters": { | ||
"code": "http://hl7.org/fhir/SearchParameter/clinical-code", | ||
"value-range": "http://hl7.org/fhir/SearchParameter/Observation-value-range" | ||
} | ||
}, | ||
"Patient": { | ||
"searchParameters": { | ||
"active": "http://hl7.org/fhir/SearchParameter/Patient-active", | ||
"address": "http://hl7.org/fhir/SearchParameter/individual-address", | ||
"birthdate": "http://hl7.org/fhir/SearchParameter/individual-birthdate", | ||
"name": "http://hl7.org/fhir/SearchParameter/Patient-name" | ||
} | ||
} | ||
}, | ||
"core": { | ||
"defaultPageSize": 500 | ||
} | ||
} | ||
} |
19 changes: 11 additions & 8 deletions
19
fhir-search/src/test/resources/config/tenant2/fhir-server-config.json
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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
{ | ||
"__comment": "FHIR Server configuration", | ||
"fhirServer": { | ||
"search": { | ||
"useStoredCompartmentParam": false | ||
} | ||
} | ||
} | ||
{ | ||
"__comment": "FHIR Server configuration", | ||
"fhirServer": { | ||
"search": { | ||
"useStoredCompartmentParam": false | ||
}, | ||
"core": { | ||
"defaultPageSize": 5000 | ||
} | ||
} | ||
} |
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.
I assume it applies to history interactions as well
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.
Also, its a bit confusing, but we have 3 separate tables in section 5.1. You added this property to the table that has the description. However, 5.1.2 has the default value and 5.1.3 indicates whether the parameter is tenant-specific (different values allowed for different tenants) and dynamic (changes take affect without a server restart).
We used to have all of this in a single table, but it was too wide for just about any documentation format.
For 5.1.2, just add a row and indicate the default is 10.
For 5.1.3, since you're using FHIRConfigHelper, this property will be dynamic and tenant-specific, so thats just Y|Y.