mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-19 05:30:43 +00:00
added ability to use filters to stop certain records from being cached, fixed insert bug due to binding instants to its default timestamp
This commit is contained in:
@ -101,7 +101,8 @@ class GetActionTest extends BaseTest
|
||||
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
|
||||
new QRecord().withValue("id", 1).withValue("firstName", "George").withValue("lastName", "Washington").withValue("noOfShoes", 5),
|
||||
new QRecord().withValue("id", 2).withValue("firstName", "John").withValue("lastName", "Adams"),
|
||||
new QRecord().withValue("id", 3).withValue("firstName", "Thomas").withValue("lastName", "Jefferson")
|
||||
new QRecord().withValue("id", 3).withValue("firstName", "Thomas").withValue("lastName", "Jefferson"),
|
||||
new QRecord().withValue("id", 3).withValue("firstName", "Thomas 503").withValue("lastName", "Jefferson")
|
||||
));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -117,6 +118,17 @@ class GetActionTest extends BaseTest
|
||||
assertEquals(5, getOutput.getRecord().getValue("noOfShoes"));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// try to get from the table which caches it - but should not find because use case should filter out because of matching 503 //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
GetInput getInput = new GetInput();
|
||||
getInput.setTableName(TestUtils.TABLE_NAME_PERSON_MEMORY_CACHE);
|
||||
getInput.setUniqueKey(Map.of("firstName", "Thomas 503", "lastName", "Jefferson"));
|
||||
GetOutput getOutput = new GetAction().execute(getInput);
|
||||
assertNull(getOutput.getRecord());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// request a row that doesn't exist in cache or source, should miss both //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -739,6 +739,15 @@ public class TestUtils
|
||||
.withSourceUniqueKey(uniqueKey)
|
||||
.withCacheUniqueKey(uniqueKey)
|
||||
.withCacheSourceMisses(false)
|
||||
.withExcludeRecordsMatching(List.of(
|
||||
new QQueryFilter(
|
||||
new QFilterCriteria(
|
||||
"firstName",
|
||||
QCriteriaOperator.CONTAINS,
|
||||
List.of("503")
|
||||
)
|
||||
)
|
||||
))
|
||||
));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user