summaryrefslogtreecommitdiffstats
path: root/models-pap
diff options
context:
space:
mode:
Diffstat (limited to 'models-pap')
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java5
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java4
2 files changed, 6 insertions, 3 deletions
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java b/models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java
index 7368d29c7..ec759d34d 100644
--- a/models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java
@@ -49,6 +49,7 @@ import org.onap.policy.models.pap.persistence.concepts.JpaPolicyAudit;
public class PolicyAuditProvider {
private static final Integer DEFAULT_MAX_RECORDS = 100;
+ private static final Integer DEFAULT_MIN_RECORDS = 10;
/**
* Create audit records.
@@ -79,7 +80,9 @@ public class PolicyAuditProvider {
* @return list of {@link PolicyAudit} records
*/
public List<PolicyAudit> getAuditRecords(@NonNull PfDao dao, @NonNull AuditFilter auditFilter) {
- if (auditFilter.getRecordNum() < 1 || auditFilter.getRecordNum() > DEFAULT_MAX_RECORDS) {
+ if (auditFilter.getRecordNum() < 1) {
+ auditFilter.setRecordNum(DEFAULT_MIN_RECORDS);
+ } else if (auditFilter.getRecordNum() > DEFAULT_MAX_RECORDS) {
auditFilter.setRecordNum(DEFAULT_MAX_RECORDS);
}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java
index 7c70371d3..41c9b92a6 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProviderTest.java
@@ -184,9 +184,9 @@ public class PolicyAuditProviderTest {
records = provider.getAuditRecords(pfDao, AuditFilter.builder().recordNum(102).build());
assertThat(records).hasSize(100);
- // try to get -1 records should return 100
+ // try to get -1 records should return 10
records = provider.getAuditRecords(pfDao, AuditFilter.builder().recordNum(-1).build());
- assertThat(records).hasSize(100);
+ assertThat(records).hasSize(10);
}
@Test