You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2007/04/02 21:25:27 UTC
svn commit: r524891 - in /incubator/ode/trunk: ./
bpel-api/src/main/java/org/apache/ode/bpel/explang/
bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/
bpel-run...
Author: mriou
Date: Mon Apr 2 12:25:26 2007
New Revision: 524891
URL: http://svn.apache.org/viewvc?view=rev&rev=524891
Log:
Fixed data handling tests (containing assignment stuff).
Modified:
incubator/ode/trunk/Rakefile
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationContext.java
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XslCompilationErrorListener.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/XmlDataDaoImpl.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExprEvaluationContextImpl.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PropertyAliasEvaluationContext.java
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity1/TestAssign.bpel
incubator/ode/trunk/utils/src/main/java/org/apache/ode/utils/xsl/XslTransformHandler.java
Modified: incubator/ode/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/Rakefile?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/Rakefile (original)
+++ incubator/ode/trunk/Rakefile Mon Apr 2 12:25:26 2007
@@ -297,7 +297,7 @@
project("ode:bpel-dao"), project("ode:bpel-runtime"),
project("ode:bpel-store"), project("ode:utils"),
DERBY, WSDL4J
-=begin
+
tests.resources.into(path_to(:test_target_dir))
tests.compile.with *compile.classpath
tests.compile.with project("ode:bpel-schemas"), project("ode:bpel-scheduler-quartz"),
@@ -306,7 +306,7 @@
COMMONS.pool, COMMONS.lang, COMMONS.logging, DERBY, JAVAX.connector,
JAVAX.transaction, JAVAX.stream, JAXEN, HSQLDB, LOG4J, XERCES, OpenJPA::REQUIRES,
QUARTZ, SAXON, XALAN, XMLBEANS
-=end
+
package :jar
end
@@ -464,3 +464,4 @@
# Lazy ass aliasing
task("jetty:bounce" => ["ode:axis2-war:jetty:bounce"])
task("jetty:shutdown" => ["ode:axis2-war:jetty:shutdown"])
+
Modified: incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationContext.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationContext.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationContext.java (original)
+++ incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationContext.java Mon Apr 2 12:25:26 2007
@@ -19,7 +19,11 @@
package org.apache.ode.bpel.explang;
import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.o.*;
+import org.apache.ode.bpel.o.OExpression;
+import org.apache.ode.bpel.o.OLink;
+import org.apache.ode.bpel.o.OMessageVarType;
+import org.apache.ode.bpel.o.OProcess;
+import org.apache.ode.bpel.o.OScope;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -30,61 +34,67 @@
*/
public interface EvaluationContext {
- /**
- * Read the value of a BPEL variable.
- *
- * @param variable
- * variable to read
- * @param part
- * the part (or <code>null</code>)
- * @return the value of the variable, wrapped in a <code>Node</code>
- */
- Node readVariable(OScope.Variable variable, OMessageVarType.Part part) throws FaultException;
-
- Node getPartData(Element message, OMessageVarType.Part part) throws FaultException;
- /**
- * Read the value of a BPEL property.
- *
- * @param variable
- * variable containing property
- * @param property
- * property to read
- * @return value of the property
- */
- String readMessageProperty(OScope.Variable variable, OProcess.OProperty property)
- throws FaultException;
-
- /**
- * Obtain the status of a control link.
- *
- * @param olink
- * link to check
- * @return <code>true</code> if the link is active, <code>false</code>
- * otherwise.
- */
- boolean isLinkActive(OLink olink) throws FaultException;
-
- /**
- * Obtain the root node.
- *
- * @return root node
- */
- Node getRootNode();
-
- /**
- * Evaluate a query expression.
- *
- * @param root
- * the root context
- * @param expr
- * the query expression
- * @return node returned by query
- */
- Node evaluateQuery(Node root, OExpression expr) throws FaultException;
-
- /**
- * Reads the current process instance id.
- * @return instance id
- */
- Long getProcessId();
+ /**
+ * Read the value of a BPEL variable.
+ *
+ * @param variable
+ * variable to read
+ * @param part
+ * the part (or <code>null</code>)
+ * @return the value of the variable, wrapped in a <code>Node</code>
+ */
+ Node readVariable(OScope.Variable variable, OMessageVarType.Part part) throws FaultException;
+
+ Node getPartData(Element message, OMessageVarType.Part part) throws FaultException;
+ /**
+ * Read the value of a BPEL property.
+ *
+ * @param variable
+ * variable containing property
+ * @param property
+ * property to read
+ * @return value of the property
+ */
+ String readMessageProperty(OScope.Variable variable, OProcess.OProperty property)
+ throws FaultException;
+
+ /**
+ * Obtain the status of a control link.
+ *
+ * @param olink
+ * link to check
+ * @return <code>true</code> if the link is active, <code>false</code>
+ * otherwise.
+ */
+ boolean isLinkActive(OLink olink) throws FaultException;
+
+ /**
+ * Obtain the root node.
+ *
+ * @return root node
+ */
+ Node getRootNode();
+
+ /**
+ * Evaluate a query expression.
+ *
+ * @param root
+ * the root context
+ * @param expr
+ * the query expression
+ * @return node returned by query
+ */
+ Node evaluateQuery(Node root, OExpression expr) throws FaultException;
+
+ /**
+ * Reads the current process instance id.
+ * @return instance id
+ */
+ Long getProcessId();
+
+ /**
+ * Indicates whether simple types should be narrowed to a Java type when
+ * using this evaluation context.
+ */
+ boolean narrowTypes();
}
Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XslCompilationErrorListener.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XslCompilationErrorListener.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XslCompilationErrorListener.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XslCompilationErrorListener.java Mon Apr 2 12:25:26 2007
@@ -19,9 +19,6 @@
package org.apache.ode.bpel.elang.xpath10.compiler;
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.TransformerException;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.compiler.api.CompilationException;
@@ -29,6 +26,9 @@
import org.apache.ode.bpel.compiler.api.CompilerContext;
import org.apache.ode.bpel.compiler.api.SourceLocation;
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.TransformerException;
+
/**
* Reports errors that occured during Xsl sheets processing. This implementation isn't
@@ -77,6 +77,9 @@
cmsg.messageText = exception.getMessageAndLocation();
CompilationException ce = new CompilationException(cmsg, exception);
SourceLocation loc = exception.getLocator() != null ? new SourceLocatorWrapper(exception.getLocator()) : null;
- _cc.recoveredFromError(loc,ce);
+ if (_cc != null)
+ _cc.recoveredFromError(loc,ce);
+ else
+ __log.error("XSL stylesheet parsing error! ", exception);
}
}
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java Mon Apr 2 12:25:26 2007
@@ -228,6 +228,8 @@
paramElmt = paramDoc;
if (__log.isDebugEnabled())
__log.debug("Passing parameter " + keyQName + " " + DOMUtils.domToString(paramDoc));
+ } else if (args.get(idx + 1) instanceof List) {
+ paramElmt = ((List) args.get(idx + 1)).get(0);
} else paramElmt = args.get(idx + 1);
parametersMap.put(keyQName, paramElmt);
@@ -250,6 +252,7 @@
try {
XslTransformHandler.getInstance().transform(xslUri, source, result, parametersMap, resolver);
} catch (Exception e) {
+ e.printStackTrace();
throw new XPathFunctionException(
new FaultException(_oxpath.getOwner().constants.qnSubLanguageExecutionFault,
e.toString()));
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java Mon Apr 2 12:25:26 2007
@@ -92,12 +92,14 @@
try{
Node variableNode = _ectx.readVariable(variable, part);
if (variableNode == null)
- throw new FaultException(variable.getOwner().constants.qnSelectionFailure, "Unknown variable " + variableName.getLocalPart());
- if (variable.type instanceof OXsdTypeVarType && ((OXsdTypeVarType)variable.type).simple)
- return getSimpleContent(variableNode,((OXsdTypeVarType)variable.type).xsdType);
- if (part != null && part.type instanceof OXsdTypeVarType && ((OXsdTypeVarType)part.type).simple)
- return getSimpleContent(variableNode,((OXsdTypeVarType)part.type).xsdType);
-
+ throw new FaultException(variable.getOwner().constants.qnSelectionFailure,
+ "Unknown variable " + variableName.getLocalPart());
+ if (_ectx.narrowTypes()) {
+ if (variable.type instanceof OXsdTypeVarType && ((OXsdTypeVarType)variable.type).simple)
+ return getSimpleContent(variableNode,((OXsdTypeVarType)variable.type).xsdType);
+ if (part != null && part.type instanceof OXsdTypeVarType && ((OXsdTypeVarType)part.type).simple)
+ return getSimpleContent(variableNode,((OXsdTypeVarType)part.type).xsdType);
+ }
// Saxon expects a node list, this nodelist should contain exactly one item, the attribute
// value
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/XmlDataDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/XmlDataDaoImpl.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/XmlDataDaoImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/XmlDataDaoImpl.java Mon Apr 2 12:25:26 2007
@@ -24,9 +24,7 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-import java.io.IOException;
import java.util.Properties;
@@ -61,6 +59,10 @@
Document doc = DOMUtils.newDocument();
Node copy = doc.importNode(_data, true);
if (_data instanceof Element) doc.appendChild(copy);
+ else {
+ Element wrapper = doc.createElement("wrapper");
+ wrapper.appendChild(copy);
+ }
return copy;
}
@@ -83,14 +85,9 @@
// spot where it exactly comes from, this fixes it.
// The weirdness lies in elements being in xmlns="" when printed with a DOMWriter
// but having a ns when the elements are queried directly.
- try {
- _data = DOMUtils.stringToDOM(DOMUtils.domToString(val));
- } catch (SAXException e) {
- // Should never happen but life is full of surprises
- throw new RuntimeException("Couldn't reread!", e);
- } catch (IOException e) {
- throw new RuntimeException("Couldn't reread!", e);
- }
+ Document doc = DOMUtils.newDocument();
+ _data = doc.importNode(val, true);
+ doc.appendChild(_data);
}
/**
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java Mon Apr 2 12:25:26 2007
@@ -633,6 +633,10 @@
public Long getProcessId() {
return _ctx.getProcessId();
}
+
+ public boolean narrowTypes() {
+ return false;
+ }
}
}
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExprEvaluationContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExprEvaluationContextImpl.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExprEvaluationContextImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExprEvaluationContextImpl.java Mon Apr 2 12:25:26 2007
@@ -22,8 +22,13 @@
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.explang.EvaluationContext;
-import org.apache.ode.bpel.o.*;
+import org.apache.ode.bpel.o.OConstantVarType;
+import org.apache.ode.bpel.o.OExpression;
+import org.apache.ode.bpel.o.OLink;
+import org.apache.ode.bpel.o.OMessageVarType;
import org.apache.ode.bpel.o.OMessageVarType.Part;
+import org.apache.ode.bpel.o.OProcess;
+import org.apache.ode.bpel.o.OScope;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -116,6 +121,10 @@
public Long getProcessId() {
return _native.getPid();
+ }
+
+ public boolean narrowTypes() {
+ return true;
}
}
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PropertyAliasEvaluationContext.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PropertyAliasEvaluationContext.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PropertyAliasEvaluationContext.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PropertyAliasEvaluationContext.java Mon Apr 2 12:25:26 2007
@@ -20,8 +20,13 @@
import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.explang.EvaluationContext;
-import org.apache.ode.bpel.o.*;
+import org.apache.ode.bpel.o.OElementVarType;
+import org.apache.ode.bpel.o.OExpression;
+import org.apache.ode.bpel.o.OLink;
+import org.apache.ode.bpel.o.OMessageVarType;
import org.apache.ode.bpel.o.OMessageVarType.Part;
+import org.apache.ode.bpel.o.OProcess;
+import org.apache.ode.bpel.o.OScope;
import org.apache.ode.utils.DOMUtils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -80,4 +85,8 @@
return null;
}
+ public boolean narrowTypes() {
+ return true;
+ }
+
}
Modified: incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java Mon Apr 2 12:25:26 2007
@@ -18,13 +18,7 @@
*/
package org.apache.ode.bpel.elang.xpath20.runtime;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
import junit.framework.TestCase;
-
import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.compiler.bom.Expression;
import org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20;
@@ -41,6 +35,10 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Map;
+
public class XPath20ExpressionRuntimeTest extends TestCase implements EvaluationContext {
private XPath20ExpressionRuntime _runtime;
@@ -141,8 +139,11 @@
// TODO Auto-generated method stub
return null;
}
-
+ public boolean narrowTypes() {
+ return true;
+ }
+
private OXPath20ExpressionBPEL20 compile(String xpath) {
Document doc = DOMUtils.newDocument();
Element e = doc.createElementNS(null, "expression");
Modified: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity1/TestAssign.bpel
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity1/TestAssign.bpel?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity1/TestAssign.bpel (original)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity1/TestAssign.bpel Mon Apr 2 12:25:26 2007
@@ -83,7 +83,7 @@
<to variable="intVar"/>
</copy>
<copy>
- <from>$intVar = 4</from>
+ <from>$intVar = 5</from>
<to variable="boolVar"/>
</copy>
<copy>
Modified: incubator/ode/trunk/utils/src/main/java/org/apache/ode/utils/xsl/XslTransformHandler.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/utils/src/main/java/org/apache/ode/utils/xsl/XslTransformHandler.java?view=diff&rev=524891&r1=524890&r2=524891
==============================================================================
--- incubator/ode/trunk/utils/src/main/java/org/apache/ode/utils/xsl/XslTransformHandler.java (original)
+++ incubator/ode/trunk/utils/src/main/java/org/apache/ode/utils/xsl/XslTransformHandler.java Mon Apr 2 12:25:26 2007
@@ -19,11 +19,6 @@
package org.apache.ode.utils.xsl;
-import java.io.StringReader;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
import javax.xml.namespace.QName;
import javax.xml.transform.ErrorListener;
import javax.xml.transform.Result;
@@ -35,6 +30,10 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamSource;
+import java.io.StringReader;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
/**
* Singleton wrapping the basic <code>javax.xml.transform</code> operations. The
@@ -129,7 +128,7 @@
tf.setURIResolver(resolver);
if (parameters != null) {
for (Map.Entry<QName, Object> param : parameters.entrySet()) {
- tf.setParameter("{" + param.getKey().getNamespaceURI() + "}" + param.getKey().getLocalPart(), param.getValue());
+ tf.setParameter(param.getKey().getLocalPart(), param.getValue());
}
}
tf.transform(source, result);