From add898baf837c1946c2f552267fd2b3afad09f6c Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 20 Dec 2016 07:23:43 +0000
Subject: [PATCH] New constructor introduce for JythonEvaluatorSpringComponent
 in order to make it usable in unit tests.

SVN: 37522
---
 .../evaluator/JythonEvaluatorSpringComponent.java      | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/source/java/ch/systemsx/cisd/common/jython/evaluator/JythonEvaluatorSpringComponent.java b/common/source/java/ch/systemsx/cisd/common/jython/evaluator/JythonEvaluatorSpringComponent.java
index d0b27e54e80..a2f74067ee1 100644
--- a/common/source/java/ch/systemsx/cisd/common/jython/evaluator/JythonEvaluatorSpringComponent.java
+++ b/common/source/java/ch/systemsx/cisd/common/jython/evaluator/JythonEvaluatorSpringComponent.java
@@ -16,6 +16,8 @@
 
 package ch.systemsx.cisd.common.jython.evaluator;
 
+import java.util.Properties;
+
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.BeanInitializationException;
 
@@ -31,6 +33,7 @@ import ch.systemsx.cisd.common.spring.ExposablePropertyPlaceholderConfigurer;
  */
 public class JythonEvaluatorSpringComponent
 {
+    public static final String JYTHON_VERSION_KEY = "jython-version";
 
     @Private
     final static Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION,
@@ -38,7 +41,12 @@ public class JythonEvaluatorSpringComponent
 
     public JythonEvaluatorSpringComponent(ExposablePropertyPlaceholderConfigurer propertyConfigurer)
     {
-        String jythonVersion = propertyConfigurer.getResolvedProps().getProperty("jython-version");
+        this(propertyConfigurer.getResolvedProps());
+    }
+
+    public JythonEvaluatorSpringComponent(Properties resolvedProps)
+    {
+        String jythonVersion = resolvedProps.getProperty(JYTHON_VERSION_KEY);
         if ("2.7".equals(jythonVersion))
         {
             Evaluator.setFactory(createJython27EvaluatorFactory());
-- 
GitLab