Skip to content

Commit

Permalink
#5: Allow configuration of max and default page limit (#6)
Browse files Browse the repository at this point in the history
* #5: Allow configuration of max and default page limit

-- Set default values to 1000 and 20

* #5: Allow configuration of max and default page limit

Fix test
  • Loading branch information
georgiosgratsias authored Nov 25, 2020
1 parent 10c9531 commit 31444c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ protected void initCrnk(CrnkBoot boot) {

TransactionRunner transactionRunner = createTransactionRunner();

boot.setMaxPageLimit(Long.parseLong(PropertyUtils.getProperty("crnk.max-page-limit", "1000")));
boot.setDefaultPageLimit(Long.parseLong(PropertyUtils.getProperty("crnk.default-page-limit", "20")));

boot.addModule(new CordaRestModule(serviceHub, cordaMapper));
boot.addModule(HomeModule.create());
boot.addModule(createJpaModule(transactionRunner));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,24 @@ public void test() {
assertThat(flow.getCurrentStep()).isEqualTo(FlowExecutionDTO.ENDED_STEP);

// garbage collect will not collect
impl.lastGc = Instant.now().minus(Duration.ofHours(1));
impl.lastGc = Instant.now().plus(Duration.ofHours(1));
impl.checkGc();
assertThat(impl.findAll(querySpec)).hasSize(1);

// garbage collect will not collect again
impl.lastGc = Instant.now().minus(Duration.ofHours(1));
impl.lastGc = Instant.now().plus(Duration.ofHours(1));
impl.checkGc();
assertThat(impl.findAll(querySpec)).hasSize(1);

// entry expired, but garbage collection will not run
flow.setLastModified(Instant.now().minus(Duration.ofHours(1)));
impl.lastGc = Instant.now().minus(Duration.ofMillis(5000));
flow.setLastModified(Instant.now().plus(Duration.ofMillis(5000)));
impl.checkGc();
assertThat(impl.findAll(querySpec)).hasSize(1);

// garbage collection not run for a long time and will finally collect
impl.lastGc = Instant.now().minus(Duration.ofHours(1));
impl.lastGc = Instant.now().minus(Duration.ofMillis(5000));
flow.setLastModified(Instant.now().minus(Duration.ofMillis(5000)));
impl.checkGc();
assertThat(impl.findAll(querySpec)).isEmpty();
}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ CRNK_VERSION=3.3.20200717191406
RMEE_GRADLE_VERSION=1.1.20200614081240
JDK_VERSION=8u202-b08

#CORDA_VERSION=4.4
CORDA_VERSION=4.5-C3C01
CORDA_VERSION=4.4
#CORDA_VERSION=4.5
CORDA_PLUGINS_VERSION=4.0.45
QUASAR_VERSION=0.7.10.

Expand All @@ -42,4 +42,4 @@ GRADLE_VERSION=6.1.1
DOCKER_VERSION=19.03.1
KUBERNETES_VERSION=v1.14.0
HELM_VERSION=v3.2.1
TF_VERSION=0.12.23
TF_VERSION=0.12.23

0 comments on commit 31444c9

Please sign in to comment.