Author: pascal.verdage
Date: 2008-07-21 07:24:21 -0400 (Mon, 21 Jul 2008)
New Revision: 1679
Modified:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/expr/ExpressionTest.java
Log:
update expression language binding and test
Modified:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java
===================================================================
---
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java 2008-07-21
08:36:44 UTC (rev 1678)
+++
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java 2008-07-21
11:24:21 UTC (rev 1679)
@@ -50,12 +50,16 @@
public Object parse(Element element, Parse parse, Parser parser) {
ObjectDescriptor descriptor = new ObjectDescriptor(ScriptManager.class);
- if (element.hasAttribute("default-language")) {
- String defaultLanguage = element.getAttribute("default-language");
- descriptor.addInjection("defaultLanguage", new
StringDescriptor(defaultLanguage));
-
+ if (element.hasAttribute("default-expression-language")) {
+ String defaultLanguage =
element.getAttribute("default-expression-language");
+ descriptor.addInjection("defaultExpressionLanguage", new
StringDescriptor(defaultLanguage));
}
+ if (element.hasAttribute("default-script-language")) {
+ String defaultLanguage =
element.getAttribute("default-script-language");
+ descriptor.addInjection("defaultScriptLanguage", new
StringDescriptor(defaultLanguage));
+ }
+
if (element.hasAttribute("read-contexts")) {
String readContextsText = element.getAttribute("read-contexts");
List<String> readContextList =
XmlUtil.parseCommaSeparatedList(readContextsText);
Modified:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/expr/ExpressionTest.java
===================================================================
---
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/expr/ExpressionTest.java 2008-07-21
08:36:44 UTC (rev 1678)
+++
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/expr/ExpressionTest.java 2008-07-21
11:24:21 UTC (rev 1679)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.expr;
+import org.jbpm.pvm.samples.activities.WaitState;
import org.jbpm.pvm.test.base.JbpmTestCase;
import org.jbpm.pvm.client.ClientProcessInstance;
import org.jbpm.pvm.env.Environment;
@@ -32,6 +33,7 @@
/**
* @author Tom Baeyens
+ * @author Pascal Verdage
*/
public class ExpressionTest extends JbpmTestCase
{
@@ -40,22 +42,27 @@
EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
"<contexts>" +
" <environment-factory>" +
- " <script-manager default-language='juel'" +
+ " <script-manager default-expression-language='juel'" +
+ " default-script-language='juel'" +
" read-contexts='execution, environment,
environment-factory' " +
" write-context='execution'>" +
" <script-language name='juel'
factory='com.sun.script.juel.JuelScriptEngineFactory' />" +
+ " <script-language name='groovy'
factory='com.sun.script.groovy.GroovyScriptEngineFactory' />" +
" </script-manager>" +
" </environment-factory>" +
"</contexts>"
);
-
+
ScriptManager scriptManager = environmentFactory.get(ScriptManager.class);
- ClientProcessInstance execution =
ProcessFactory.build().done().beginProcessInstance();
+ ClientProcessInstance execution =
+ ProcessFactory.build()
+ .node("unused").initial().behaviour(WaitState.class)
+ .done().beginProcessInstance();
execution.setVariable("pv", "hello");
Environment environment = environmentFactory.openEnvironment();
try {
- assertEquals("hello", scriptManager.evaluate("#{pv}",
execution, null));
+ assertEquals("hello", scriptManager.evaluateExpression("#{pv}",
execution, null));
} finally {
environment.close();