diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/dynamic_property/DynamicPropertyEvaluator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/dynamic_property/DynamicPropertyEvaluator.java index 10193d9171163e0c6408bb233c703ffba48d7fd7..3e7af59a069cba8c43e4d84c6b28ba0c6d0c0331 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/dynamic_property/DynamicPropertyEvaluator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/dynamic_property/DynamicPropertyEvaluator.java @@ -29,10 +29,10 @@ import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogFactory; import ch.systemsx.cisd.openbis.generic.server.business.bo.EntityPropertiesConverter; import ch.systemsx.cisd.openbis.generic.server.business.bo.EntityPropertiesConverter.ComplexPropertyValueHelper; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IEntityPropertiesConverter; import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.calculator.DynamicPropertyCalculator; import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.calculator.EntityAdaptorFactory; import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.calculator.IEntityAdaptor; -import ch.systemsx.cisd.openbis.generic.server.business.bo.IEntityPropertiesConverter; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.shared.basic.BasicConstant; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityPropertyPE; @@ -174,7 +174,6 @@ public class DynamicPropertyEvaluator implements IDynamicPropertyEvaluator } final DynamicPropertyCalculator calculator = getCalculator(etpt.getScript()); calculator.setEntity(entityAdaptor); - etpt.getEntityType().getEntityKind(); final String dynamicValue = calculator.evalAsString(); final String validatedValue = entityPropertiesConverter.tryCreateValidatedPropertyValue(etpt.getEntityType() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/dynamic_property/DynamicPropertyEvaluatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/dynamic_property/DynamicPropertyEvaluatorTest.java index 86da15df45af0c0148d5eeff1ed023579f8cdd7a..5218fb7a289e3c415e59f1138fdd199f54f97dc0 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/dynamic_property/DynamicPropertyEvaluatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/dynamic_property/DynamicPropertyEvaluatorTest.java @@ -27,7 +27,7 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.DynamicPropertyEvaluator; +import ch.systemsx.cisd.common.logging.LogInitializer; import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.calculator.AbstractEntityAdaptor; import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.calculator.BasicPropertyAdaptor; import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.calculator.IEntityAdaptor; @@ -41,6 +41,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePropertyTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.PropertyTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePropertyPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePropertyTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.ScriptPE; @@ -57,6 +58,7 @@ public class DynamicPropertyEvaluatorTest extends AssertJUnit @BeforeMethod public void setUp() { + LogInitializer.init(); daoFactory = new Mockery().mock(IDAOFactory.class); evaluator = new DynamicPropertyEvaluator(daoFactory); } @@ -202,9 +204,9 @@ public class DynamicPropertyEvaluatorTest extends AssertJUnit sample = createSample("s1", properties); evaluator.evaluateProperties(sample); // cyclic dependency should be found - assertEquals(expectedCyclicDependencyErrorMessage(dp1, dp2, dp3, dp1), dp1.getValue()); - assertEquals(expectedCyclicDependencyErrorMessage(dp1, dp2, dp3, dp1), dp2.getValue()); - assertEquals(expectedCyclicDependencyErrorMessage(dp1, dp2, dp3, dp1), dp3.getValue()); + assertEquals(expectedCyclicDependencyErrorMessage(dp2, dp3, dp1, dp2), dp1.getValue()); + assertEquals(expectedCyclicDependencyErrorMessage(dp2, dp3, dp1, dp2), dp2.getValue()); + assertEquals(expectedCyclicDependencyErrorMessage(dp2, dp3, dp1, dp2), dp3.getValue()); } // @@ -303,6 +305,7 @@ public class DynamicPropertyEvaluatorTest extends AssertJUnit assignment.setPropertyType(propertyType); assignment.setDynamic(true); assignment.setScript(script); + assignment.setEntityType(new SampleTypePE()); return assignment; }