From fbf845ab09b06732d3d063aa7609dde05bfb83e3 Mon Sep 17 00:00:00 2001 From: alaskowski <alaskowski@ethz.ch> Date: Thu, 20 Jul 2023 11:39:53 +0200 Subject: [PATCH] SSDM-55: fixed create property and jython tests. --- .../property/CreatePropertyTypeExecutor.java | 3 ++- .../JythonManagedPropertyEvaluatorTest.java | 14 +++++++------- .../shared/managed_property/updateFromUI-test.py | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/property/CreatePropertyTypeExecutor.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/property/CreatePropertyTypeExecutor.java index daca8bfbc87..0459dd9f85d 100644 --- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/property/CreatePropertyTypeExecutor.java +++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/property/CreatePropertyTypeExecutor.java @@ -207,7 +207,8 @@ public class CreatePropertyTypeExecutor propertyType.setSchema(creation.getSchema()); propertyType.setTransformation(creation.getTransformation()); propertyType.setMetaData(creation.getMetaData()); - propertyType.setMultiValue(creation.isMultiValue()); + propertyType.setMultiValue( + creation.isMultiValue() != null && creation.isMultiValue()); propertyTypes.add(propertyType); } diff --git a/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/JythonManagedPropertyEvaluatorTest.java b/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/JythonManagedPropertyEvaluatorTest.java index 811eae702c3..6f6605d1bc1 100644 --- a/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/JythonManagedPropertyEvaluatorTest.java +++ b/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/JythonManagedPropertyEvaluatorTest.java @@ -284,7 +284,7 @@ public class JythonManagedPropertyEvaluatorTest extends AssertJUnit { JythonManagedPropertyEvaluator evaluator = new JythonManagedPropertyEvaluator("def updateFromUI(action):\n" - + " property.setValue(person.getUserId() + ';' + person.getUserName())"); + + " property.setStringValue(person.getUserId() + ';' + person.getUserName())"); ManagedProperty property = new ManagedProperty(); property.setPropertyTypeCode("p"); IPerson person = new PersonAdapter("jbravo", "Johny", "Bravo"); @@ -448,7 +448,7 @@ public class JythonManagedPropertyEvaluatorTest extends AssertJUnit { JythonManagedPropertyEvaluator evaluator = new JythonManagedPropertyEvaluator("def updateFromBatchInput(bindings):\n" - + " property.setValue(bindings.get(''))"); + + " property.setStringValue(bindings.get(''))"); ManagedProperty property = new ManagedProperty(); property.setPropertyTypeCode("p"); IPerson person = new PersonAdapter("test", null, null); @@ -466,7 +466,7 @@ public class JythonManagedPropertyEvaluatorTest extends AssertJUnit JythonManagedPropertyEvaluator evaluator = new JythonManagedPropertyEvaluator("def batchColumnNames():\n return ['A', 'B']\n" + "def updateFromBatchInput(bindings):\n" - + " property.setValue(bindings.get('A') + bindings.get('B'))"); + + " property.setStringValue(bindings.get('A') + bindings.get('B'))"); ManagedProperty property = new ManagedProperty(); property.setPropertyTypeCode("p"); IPerson person = new PersonAdapter("test", null, null); @@ -486,7 +486,7 @@ public class JythonManagedPropertyEvaluatorTest extends AssertJUnit new JythonManagedPropertyEvaluator( "def batchColumnNames():\n return ['BC1', 'BC2']\n" + "def updateFromBatchInput(bindings):\n" - + " property.setValue(bindings.get('BC1') + ' ' + " + + " property.setStringValue(bindings.get('BC1') + ' ' + " + "bindings.get('BC2') + ' ' + " + "bindings.get(originalColumnNameBindingKey('OC')))"); ManagedProperty property = new ManagedProperty(); @@ -507,7 +507,7 @@ public class JythonManagedPropertyEvaluatorTest extends AssertJUnit { JythonManagedPropertyEvaluator evaluator = new JythonManagedPropertyEvaluator("def updateFromBatchInput(bindings):\n" - + " property.setValue(person.getUserId() + ';' + person.getUserName())"); + + " property.setStringValue(person.getUserId() + ';' + person.getUserName())"); ManagedProperty property = new ManagedProperty(); property.setPropertyTypeCode("p"); IPerson person = new PersonAdapter("jbravo", "Johny", "Bravo"); @@ -523,7 +523,7 @@ public class JythonManagedPropertyEvaluatorTest extends AssertJUnit { JythonManagedPropertyEvaluator evaluator = new JythonManagedPropertyEvaluator("def updateFromBatchInput(bindings):\n" - + " property.setValue(person.getUserId() + ';' + person.getUserName())"); + + " property.setStringValue(person.getUserId() + ';' + person.getUserName())"); ManagedProperty property = new ManagedProperty(); property.setPropertyTypeCode("p"); IPerson person = new PersonAdapter("jbravo", null, null); @@ -539,7 +539,7 @@ public class JythonManagedPropertyEvaluatorTest extends AssertJUnit { JythonManagedPropertyEvaluator evaluator = new JythonManagedPropertyEvaluator("def updateFromBatchInput(bindings):\n" - + " property.setValue(person)"); + + " property.setStringValue(person)"); ManagedProperty property = new ManagedProperty(); property.setPropertyTypeCode("p"); Map<String, String> bindings = new HashMap<String, String>(); diff --git a/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/updateFromUI-test.py b/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/updateFromUI-test.py index 0413e96856e..e330cf13f2c 100644 --- a/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/updateFromUI-test.py +++ b/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/updateFromUI-test.py @@ -6,7 +6,7 @@ def updateFromUI(action): if inputValue is None: inputValue = 'null' value = value + input.getLabel() + '=' + inputValue + '|' - property.setValue(value) + property.setStringValue(value) elif action.getName() == 'a2': value = 'a2!' for input in action.getInputWidgetDescriptions(): @@ -14,6 +14,6 @@ def updateFromUI(action): if inputValue is None: inputValue = 'null' value = value + input.getLabel() + '=' + inputValue + '!' - property.setValue(value) + property.setStringValue(value) else: raise ValidationException('action ' + action.getName() + ' is not supported') \ No newline at end of file -- GitLab