FIX: Pairs must not be modified by query (#1539)

* FIX: Pairs must not be modified by query

* Modification can also occur on inValues.

* fixed tests

* removed obsolete line
This commit is contained in:
Roland Praml
2018-11-13 23:41:36 +13:00
committed by Rob Bygrave
parent 01d9dd3fe8
commit 105f08cca1
5 changed files with 47 additions and 27 deletions
@@ -31,9 +31,9 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
if (!loadOnce) {
Ebean.find(OCachedNatKeyBean3.class).delete();
List<String> stores = new ArrayList<>(Arrays.asList("abc", "def"));
List<String> stores =Arrays.asList("abc", "def");
for (String store : stores) {
List<String> skus = new ArrayList<>(Arrays.asList("1", "2", "3"));
List<String> skus = Arrays.asList("1", "2", "3");
for (String sku : skus) {
int[] codes = {1000,1001,1002,1003,1004};
for (int code : codes) {
@@ -99,7 +99,7 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
loadSomeIntoCache();
List<Integer> codes = new ArrayList<>(Arrays.asList(1001, 1000, 1002, 1003));
List<Integer> codes = Arrays.asList(1001, 1000, 1002, 1003);
LoggedSqlCollector.start();
@@ -132,7 +132,7 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
setup();
loadSomeIntoCache();
List<String> skus = new ArrayList<>(Arrays.asList("2", "3"));
List<String> skus = Arrays.asList("2", "3");
LoggedSqlCollector.start();
@@ -162,7 +162,7 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
loadSomeIntoCache();
String storeId = "abc";
List<String> skus = new ArrayList<>(Arrays.asList("3", "2", "4"));
List<String> skus = Arrays.asList("3", "2", "4");
LoggedSqlCollector.start();
@@ -272,6 +272,8 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
List<String> sql = LoggedSqlCollector.stop();
assertThat(pairs.getEntries()).hasSize(3);
assertThat(list).hasSize(3);
assertNaturalKeyHitMiss(1, 2);
assertBeanCacheHitMiss(1, 0);
@@ -313,6 +315,8 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
List<String> sql = LoggedSqlCollector.stop();
assertThat(pairs.getEntries()).hasSize(3);
assertThat(list).hasSize(3);
assertNaturalKeyHitMiss(1, 2);
assertBeanCacheHitMiss(1, 0);