From e334e00183ca6a52fdd059383256e3b4a3bca7c6 Mon Sep 17 00:00:00 2001
From: Viktor Kovtun <viktor.kovtun@id.ethz.ch>
Date: Mon, 28 Sep 2020 11:36:53 +0200
Subject: [PATCH] SSDM-10151 Fixed test flakiness for any property and any
 field tests.

---
 .../asapi/v3/AbstractSearchPropertyTest.java  | 34 +++++++++----------
 .../asapi/v3/SearchMaterialTest.java          | 32 ++++++++---------
 2 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractSearchPropertyTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractSearchPropertyTest.java
index f7eb53d27ef..9916612d665 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractSearchPropertyTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractSearchPropertyTest.java
@@ -353,14 +353,14 @@ public abstract class AbstractSearchPropertyTest extends AbstractTest
                 { DataType.VARCHAR, "12", "== 12", true },
                 { DataType.VARCHAR, "ab", "<= abc", true },
                 { DataType.VARCHAR, "12", "> 100", true },
-                { DataType.VARCHAR, "acd3", "contains bcd and endsWith 34", false },
-                { DataType.VARCHAR, "abcd3", "contains bcd and endsWith 34", false },
-                { DataType.VARCHAR, "abd34", "contains bcd and endsWith 34", false },
-                { DataType.VARCHAR, "abcd34", "contains bcd and endsWith 34", true },
-                { DataType.MULTILINE_VARCHAR, "ac3", "contains bc or endsWith 4", false },
-                { DataType.MULTILINE_VARCHAR, "abc3", "contains bc or endsWith 4", true },
-                { DataType.MULTILINE_VARCHAR, "ab4", "contains bc or endsWith 4", true },
-                { DataType.MULTILINE_VARCHAR, "abc4", "contains bc or endsWith 4", true },
+                { DataType.VARCHAR, "acd3", "contains bcd and endsWith d34", false },
+                { DataType.VARCHAR, "abcd3", "contains bcd and endsWith d34", false },
+                { DataType.VARCHAR, "abd34", "contains bcd and endsWith d34", false },
+                { DataType.VARCHAR, "abcd34", "contains bcd and endsWith d34", true },
+                { DataType.MULTILINE_VARCHAR, "acd3", "contains bcd or endsWith cd4", false },
+                { DataType.MULTILINE_VARCHAR, "abcd3", "contains bcd or endsWith cd4", true },
+                { DataType.MULTILINE_VARCHAR, "abd4", "contains bcd or endsWith bd4", true },
+                { DataType.MULTILINE_VARCHAR, "abcd4", "contains bcd or endsWith cd4", true },
                 { DataType.MULTILINE_VARCHAR, "12", "> 100 and <= 13", true },
                 { DataType.BOOLEAN, "true", "== true", true },
                 { DataType.BOOLEAN, "true", "== false", false },
@@ -385,14 +385,14 @@ public abstract class AbstractSearchPropertyTest extends AbstractTest
                 { DataType.INTEGER, "24", ">= 23.5 or <= 19.5", true },
                 { DataType.INTEGER, "19", ">= 24 or <= 19", true },
                 { DataType.INTEGER, "24", ">= 24 or <= 19", true },
-                { DataType.INTEGER, "12345", "startsWith 12 and endsWith 45", true },
-                { DataType.INTEGER, "12345", "startsWith 13 and endsWith 45", false },
-                { DataType.INTEGER, "12345", "startsWith 12 and endsWith 55", false },
-                { DataType.INTEGER, "12345", "startsWith 11 and endsWith 55", false },
-                { DataType.INTEGER, "12345", "startsWith 12 or endsWith 45", true },
-                { DataType.INTEGER, "12345", "startsWith 13 or endsWith 45", true },
-                { DataType.INTEGER, "12345", "startsWith 12 or endsWith 55", true },
-                { DataType.INTEGER, "12345", "startsWith 11 or endsWith 55", false },
+                { DataType.INTEGER, "12345", "startsWith 123 and endsWith 345", true },
+                { DataType.INTEGER, "12345", "startsWith 133 and endsWith 345", false },
+                { DataType.INTEGER, "12345", "startsWith 123 and endsWith 355", false },
+                { DataType.INTEGER, "12345", "startsWith 113 and endsWith 355", false },
+                { DataType.INTEGER, "12345", "startsWith 123 or endsWith 345", true },
+                { DataType.INTEGER, "12345", "startsWith 133 or endsWith 345", true },
+                { DataType.INTEGER, "12345", "startsWith 123 or endsWith 355", true },
+                { DataType.INTEGER, "12345", "startsWith 113 or endsWith 355", false },
                 { DataType.INTEGER, "12345", "contains 234", true },
                 { DataType.INTEGER, "12345", "contains 437", false },
                 { DataType.REAL, "12.345", "startsWith 12. and endsWith 45", true },
@@ -628,7 +628,7 @@ public abstract class AbstractSearchPropertyTest extends AbstractTest
 
     static final class StringQueryInjector extends AbstractQueryInjector
     {
-        private boolean anyField;
+        private final boolean anyField;
 
         StringQueryInjector(final AbstractEntitySearchCriteria<?> searchCriteria,
                 final PropertyTypePermId propertyTypeId, final boolean anyField)
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTest.java
index 2792f9fe51a..9565745e2a4 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTest.java
@@ -1102,14 +1102,14 @@ public class SearchMaterialTest extends AbstractTest
                 { DataType.VARCHAR, "12", "== 12", true },
                 { DataType.VARCHAR, "ab", "<= abc", true },
                 { DataType.VARCHAR, "12", "> 100", true },
-                { DataType.VARCHAR, "acd3", "contains bcd and endsWith 34", false },
-                { DataType.VARCHAR, "abcd3", "contains bcd and endsWith 34", false },
-                { DataType.VARCHAR, "abd34", "contains bcd and endsWith 34", false },
-                { DataType.VARCHAR, "abcd34", "contains bcd and endsWith 34", true },
-                { DataType.MULTILINE_VARCHAR, "ac3", "contains bc or endsWith 4", false },
-                { DataType.MULTILINE_VARCHAR, "abc3", "contains bc or endsWith 4", true },
-                { DataType.MULTILINE_VARCHAR, "ab4", "contains bc or endsWith 4", true },
-                { DataType.MULTILINE_VARCHAR, "abc4", "contains bc or endsWith 4", true },
+                { DataType.VARCHAR, "acd3", "contains bcd and endsWith d34", false },
+                { DataType.VARCHAR, "abcd3", "contains bcd and endsWith d34", false },
+                { DataType.VARCHAR, "abd34", "contains bcd and endsWith d34", false },
+                { DataType.VARCHAR, "abcd34", "contains bcd and endsWith d34", true },
+                { DataType.MULTILINE_VARCHAR, "acd3", "contains bcd or endsWith cd4", false },
+                { DataType.MULTILINE_VARCHAR, "abcd3", "contains bcd or endsWith cd4", true },
+                { DataType.MULTILINE_VARCHAR, "abd4", "contains bcd or endsWith bd4", true },
+                { DataType.MULTILINE_VARCHAR, "abcd4", "contains bcd or endsWith cd4", true },
                 { DataType.MULTILINE_VARCHAR, "12", "> 100 and <= 13", true },
                 { DataType.BOOLEAN, "true", "== true", true },
                 { DataType.BOOLEAN, "true", "== false", false },
@@ -1134,14 +1134,14 @@ public class SearchMaterialTest extends AbstractTest
                 { DataType.INTEGER, "24", ">= 23.5 or <= 19.5", true },
                 { DataType.INTEGER, "19", ">= 24 or <= 19", true },
                 { DataType.INTEGER, "24", ">= 24 or <= 19", true },
-                { DataType.INTEGER, "12345", "startsWith 12 and endsWith 45", true },
-                { DataType.INTEGER, "12345", "startsWith 13 and endsWith 45", false },
-                { DataType.INTEGER, "12345", "startsWith 12 and endsWith 55", false },
-                { DataType.INTEGER, "12345", "startsWith 11 and endsWith 55", false },
-                { DataType.INTEGER, "12345", "startsWith 12 or endsWith 45", true },
-                { DataType.INTEGER, "12345", "startsWith 13 or endsWith 45", true },
-                { DataType.INTEGER, "12345", "startsWith 12 or endsWith 55", true },
-                { DataType.INTEGER, "12345", "startsWith 11 or endsWith 55", false },
+                { DataType.INTEGER, "12345", "startsWith 123 and endsWith 345", true },
+                { DataType.INTEGER, "12345", "startsWith 133 and endsWith 345", false },
+                { DataType.INTEGER, "12345", "startsWith 123 and endsWith 355", false },
+                { DataType.INTEGER, "12345", "startsWith 113 and endsWith 355", false },
+                { DataType.INTEGER, "12345", "startsWith 123 or endsWith 345", true },
+                { DataType.INTEGER, "12345", "startsWith 133 or endsWith 345", true },
+                { DataType.INTEGER, "12345", "startsWith 123 or endsWith 355", true },
+                { DataType.INTEGER, "12345", "startsWith 113 or endsWith 355", false },
                 { DataType.INTEGER, "12345", "contains 234", true },
                 { DataType.INTEGER, "12345", "contains 437", false },
                 { DataType.REAL, "12.345", "startsWith 12. and endsWith 45", true },
-- 
GitLab