From 7ebdd27c141a4e09a4646634eeb6a196b145ce38 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 20 Dec 2016 07:24:18 +0000
Subject: [PATCH] SSDM-4187: fixing DynamicPropertyEvaluatorTest

SVN: 37523
---
 .../DynamicPropertyEvaluatorTest.java            | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/DynamicPropertyEvaluatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/DynamicPropertyEvaluatorTest.java
index aa47e01ae58..2eaeb4e18f7 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/DynamicPropertyEvaluatorTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/DynamicPropertyEvaluatorTest.java
@@ -16,10 +16,12 @@
 
 package ch.systemsx.cisd.openbis.generic.server.dataaccess.dynamic_property;
 
+
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
+import java.util.Properties;
 import java.util.Set;
 
 import org.hibernate.Query;
@@ -28,6 +30,7 @@ import org.jmock.Expectations;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import ch.systemsx.cisd.common.jython.evaluator.JythonEvaluatorSpringComponent;
 import ch.systemsx.cisd.common.logging.LogInitializer;
 import ch.systemsx.cisd.openbis.generic.server.TestJythonEvaluatorPool;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.AbstractBOTest;
@@ -70,6 +73,9 @@ public class DynamicPropertyEvaluatorTest extends AbstractBOTest
     public void setUp()
     {
         LogInitializer.init();
+        Properties properties = new Properties();
+        properties.setProperty(JythonEvaluatorSpringComponent.JYTHON_VERSION_KEY, "2.7");
+        new JythonEvaluatorSpringComponent(properties); // set up Jython evaluator factory
 
         final Session session = context.mock(Session.class);
         sessionProvider = new IHibernateSessionProvider()
@@ -396,8 +402,8 @@ public class DynamicPropertyEvaluatorTest extends AbstractBOTest
         sample = createSample("s1", properties);
         evaluator.evaluateProperties(sample, sessionProvider.getSession());
         // cyclic dependency should be found
-        assertEquals(expectedCyclicDependencyErrorMessage(dp2, dp1, dp2), dp1.getValue());
-        assertEquals(expectedCyclicDependencyErrorMessage(dp2, dp1, dp2), dp2.getValue());
+        assertEquals(expectedCyclicDependencyErrorMessage(dp1, dp2, dp1), dp1.getValue());
+        assertEquals(expectedCyclicDependencyErrorMessage(dp1, dp2, dp1), dp2.getValue());
 
         // dp1 -> dp2 -> dp3 -> dp1
         properties = new LinkedHashSet<SamplePropertyPE>();
@@ -411,9 +417,9 @@ public class DynamicPropertyEvaluatorTest extends AbstractBOTest
         sample = createSample("s1", properties);
         evaluator.evaluateProperties(sample, sessionProvider.getSession());
         // 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(dp3, dp1, dp2, dp3), dp1.getValue());
+        assertEquals(expectedCyclicDependencyErrorMessage(dp3, dp1, dp2, dp3), dp2.getValue());
+        assertEquals(expectedCyclicDependencyErrorMessage(dp3, dp1, dp2, dp3), dp3.getValue());
     }
 
     //
-- 
GitLab