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:
Tim Chamberlain
2023-03-13 20:02:37 -05:00
parent ec05f7ab7e
commit e0f5c3ff49
5 changed files with 96 additions and 9 deletions

View File

@ -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 //
///////////////////////////////////////////////////////////////////////////

View File

@ -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")
)
)
))
));
}