Problem with entity cache?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem with entity cache?

Adrian Crum-3
While working on the entity engine code, I noticed what appeared to be a
flaw in the entity cache implementation. So, I wrote a unit test to
confirm my suspicion and the test confirms the flaw. There is a
possibility it is a design "feature" so I'm asking for help here.

Here is the test code:

         // Test entity condition cache
         EntityCondition testCondition =
EntityCondition.makeCondition("description", EntityOperator.EQUALS,
"Testing Type #2");
         List<GenericValue> testList = delegator.findList("TestingType",
testCondition, null, null, null, true);
         assertEquals("Delegator findList returned one value", 1,
testList.size());
         testValue = testList.get(0);
         assertEquals("Retrieved from cache value has the correct
description", "Testing Type #2", testValue.getString("description"));
         testValue = (GenericValue) testValue.clone();
         testValue.put("description", "New Testing Type #2");
         testValue.store();
         testList = delegator.findList("TestingType", testCondition,
null, null, null, true);
         assertEquals("Delegator findList returned empty list", 0,
testList.size());

The last assert fails - indicating a stale cache.

Am I correct or am I missing something?

-Adrian