Skip to content

Commit

Permalink
Add tests for the unsafe paging property
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
  • Loading branch information
berezovskyi committed Feb 15, 2022
1 parent 4fb81ec commit 3605808
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

### Added

- LyoStore: Providing a system property `OSLC4JUtils.hasLyoStorePagingPreciseLimit()` to allow the application to check whether query paging should return an exact number of elements in a paged query, or not (`OSLC4JConstants.LYO_STORE_PAGING_PRECISE_LIMIT`).


Expand All @@ -12,7 +13,7 @@
- Jena renamed `RDFReader/RDFWriter` to `RDFReaderI/RDFWriterI`
- LyoStore: Ordering resources by their subject IDs when doing a query to store. This ordering can be disabled with a call to `OSLC4JUtils.setLyoStorePagingUnsafe(true)`
- LyoStore: `OSLC4JUtils.hasLyoStorePagingPreciseLimit()` will return true by default. Call `OSLC4JUtils.setLyoStorePagingPreciseLimit(false)` to restore the old behavior.

- `oslc4j-json4j-provider` uses `wink-json4j` version 1.4 instead of 1.2.1-incubating.

### Deprecated

Expand All @@ -24,11 +25,11 @@
- **`lyo-validation` temporarily removed from the build**
- `oslc4j-wink` was removed
- `oslc4j-registry` was removed
- Store support for TDB1 and in-memory backends was removed.
- Store support for direct TDB1 backend was removed. You can still create a SPARQL query executor over an in-mem TDB1 dataset: `new DatasetQueryExecutorImpl(TDBFactory.createDataset())`.

### Fixed

## 4.1.0
## [4.1.0]

### Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,30 @@ public void resolveServletUriWithoutPublicUri() {
assertEquals("https://hostname.example.com:12357/myapp/resources", fullUri);
}

@Test
public void storePagingSafeByDefault() {
System.clearProperty(OSLC4JConstants.LYO_STORE_PAGING_UNSAFE);
assertFalse(OSLC4JUtils.isLyoStorePagingUnsafe());
}

@Test
public void storePagingUnsafeSetViaProperty() {
System.clearProperty(OSLC4JConstants.LYO_STORE_PAGING_UNSAFE);
assertFalse(OSLC4JUtils.isLyoStorePagingUnsafe());

System.setProperty(OSLC4JConstants.LYO_STORE_PAGING_UNSAFE, "true");
assertTrue(OSLC4JUtils.isLyoStorePagingUnsafe());
}

@Test
public void storePagingUnsafeSetViaSetter() {
System.setProperty(OSLC4JConstants.LYO_STORE_PAGING_UNSAFE, "true");
assertTrue(OSLC4JUtils.isLyoStorePagingUnsafe());

OSLC4JUtils.setLyoStorePagingUnsafe(false);
assertFalse(OSLC4JUtils.isLyoStorePagingUnsafe());
}

private HttpServletRequest mockRequest() {
HttpServletRequest mockedRequest = Mockito.mock(HttpServletRequest.class);
when(mockedRequest.getScheme()).thenReturn("https");
Expand Down

0 comments on commit 3605808

Please sign in to comment.