|
Author: adrianc
Date: Tue Apr 23 06:54:17 2013 New Revision: 1470827 URL: http://svn.apache.org/r1470827 Log: Reverting revision 1470736 which was causing some tests to fail. Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java?rev=1470827&r1=1470826&r2=1470827&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/EntityListCache.java Tue Apr 23 06:54:17 2013 @@ -20,13 +20,10 @@ package org.ofbiz.entity.cache; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.concurrent.ConcurrentMap; -import org.ofbiz.base.util.Debug; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; -import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.util.EntityUtil; public class EntityListCache extends AbstractEntityConditionCache<Object, List<GenericValue>> { @@ -67,16 +64,7 @@ public class EntityListCache extends Abs } public List<GenericValue> put(String entityName, EntityCondition condition, List<String> orderBy, List<GenericValue> entities) { - ModelEntity entity = this.getDelegator().getModelEntity(entityName); - if (entity.getNeverCache()) { - Debug.logWarning("Tried to put a value of the " + entityName + " entity in the cache but this entity has never-cache set to true, not caching.", module); - return null; - } - for (GenericValue memberValue : entities) { - memberValue.setImmutable(); - } - Map<Object, List<GenericValue>> conditionCache = getOrCreateConditionCache(entityName, getFrozenConditionKey(condition)); - return conditionCache.put(getOrderByKey(orderBy), entities); + return super.put(entityName, getFrozenConditionKey(condition), getOrderByKey(orderBy), entities); } public List<GenericValue> remove(String entityName, EntityCondition condition, List<String> orderBy) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=1470827&r1=1470826&r2=1470827&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Tue Apr 23 06:54:17 2013 @@ -137,24 +137,18 @@ public class EntityTestSuite extends Ent } catch (UnsupportedOperationException e) { } // Test entity condition cache + /* Commenting this out for now because the tests fail due to flaws in the EntityListCache implementation. 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")); - // Test immutable try { testValue.put("description", "New Testing Type #2"); testValue.store(); fail("Modified an immutable GenericValue"); } catch (IllegalStateException e) { } - try { - testValue.remove("description"); - fail("Modified an immutable GenericValue"); - } catch (UnsupportedOperationException e) { - } - /* Commenting this out for now because the tests fail due to flaws in the EntityListCache implementation. testValue = (GenericValue) testValue.clone(); testValue.put("description", "New Testing Type #2"); testValue.store(); |
| Free forum by Nabble | Edit this page |
