You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2006/11/29 00:47:04 UTC

svn commit: r480289 [2/2] - in /incubator/ode/trunk: ./ axis2-war/ bpel-compiler/ bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/ bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/ bpel-compiler/src/main/java/org/apa...

Added: incubator/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java?view=auto&rev=480289
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java (added)
+++ incubator/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java Tue Nov 28 15:47:00 2006
@@ -0,0 +1,136 @@
+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;
+import org.apache.ode.bpel.elang.xpath20.o.OXPath20ExpressionBPEL20;
+import org.apache.ode.bpel.explang.EvaluationContext;
+import org.apache.ode.bpel.o.OExpression;
+import org.apache.ode.bpel.o.OLink;
+import org.apache.ode.bpel.o.OMessageVarType.Part;
+import org.apache.ode.bpel.o.OProcess.OProperty;
+import org.apache.ode.bpel.o.OScope.Variable;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class XPath20ExpressionRuntimeTest extends TestCase implements EvaluationContext {
+    
+    private XPath20ExpressionRuntime _runtime;
+    private Map<String, Node> _vars;
+    private XPath20ExpressionCompilerBPEL20 _compiler;
+
+    private MockCompilerContext _cc;
+    private Document _vardoc;
+    public XPath20ExpressionRuntimeTest() {}
+    
+    @Override
+    public void setUp() throws Exception {
+        _vars = new HashMap<String, Node>();
+        _cc = new MockCompilerContext();
+        _runtime = new XPath20ExpressionRuntime();       
+        _runtime.initialize(new HashMap());
+        _compiler = new XPath20ExpressionCompilerBPEL20();
+        _compiler.setCompilerContext(_cc);
+        
+        _vardoc = DOMUtils.parse(getClass().getResourceAsStream("/variables.xml"));
+        NodeList variables = _vardoc.getDocumentElement().getChildNodes();
+        for (int i = 0; i < variables.getLength(); ++i) {
+            Node n = variables.item(i);
+            if (n.getNodeType()!=Node.ELEMENT_NODE)
+                continue;
+            Element v = (Element) n;
+            v.normalize();
+            if (v.getLocalName().equals("elementVar")) {
+                String name = v.getAttribute("name");
+                Node cn = v.getFirstChild();
+                while (cn != null && cn.getNodeType() != Node.ELEMENT_NODE)
+                    cn = cn.getNextSibling();
+                Element el = (Element)cn;
+                _cc.registerElementVar(name, new QName(el.getNamespaceURI(),el.getLocalName()));
+                _vars.put(name,el);
+            }
+        }
+    }
+
+    public void testCompilation() throws Exception {
+        compile("$foo");
+    }
+    
+    public void testVariableSelection() throws Exception {
+        OXPath20ExpressionBPEL20 exp = compile("$foo");
+        Node retVal = _runtime.evaluateNode(exp, this);
+        assertNotNull(retVal);
+        assertSame(retVal , _vars.get("foo"));
+        assertSame(retVal.getOwnerDocument(),_vardoc);
+    }
+
+    public void testVariableSelectionEmpty() throws Exception {
+        OXPath20ExpressionBPEL20 exp = compile("$emptyVar");
+        Node retVal = _runtime.evaluateNode(exp, this);
+        assertNotNull(retVal);
+        assertSame(retVal , _vars.get("emptyVar"));
+        assertTrue(DOMUtils.getFirstChildElement((Element)retVal).getLocalName().equals("empty"));
+    }
+
+    public void testVariableSelectionReallyEmpty() throws Exception {
+        OXPath20ExpressionBPEL20 exp = compile("$reallyEmptyVar");
+        Node retVal = _runtime.evaluateNode(exp, this);
+        assertNotNull(retVal);
+        assertSame(retVal , _vars.get("reallyEmptyVar"));
+        assertNull(DOMUtils.getFirstChildElement((Element)retVal));
+    }
+
+    public Node readVariable(Variable variable, Part part) throws FaultException {
+        return _vars.get(variable.name);
+    }
+
+    public Node getPartData(Element message, Part part) throws FaultException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String readMessageProperty(Variable variable, OProperty property) throws FaultException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isLinkActive(OLink olink) throws FaultException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public Node getRootNode() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Node evaluateQuery(Node root, OExpression expr) throws FaultException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Long getProcessId() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+
+    private OXPath20ExpressionBPEL20 compile(String xpath) {
+        Document doc = DOMUtils.newDocument();
+        Element e = doc.createElement("expression");
+        doc.appendChild(e);
+        e.appendChild(doc.createTextNode(xpath));
+        Expression exp = new Expression(e);
+        return (OXPath20ExpressionBPEL20)_compiler.compileLValue(exp);
+    }
+}

Propchange: incubator/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/ode/trunk/bpel-compiler/src/test/resources/variables.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/test/resources/variables.xml?view=auto&rev=480289
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/test/resources/variables.xml (added)
+++ incubator/ode/trunk/bpel-compiler/src/test/resources/variables.xml Tue Nov 28 15:47:00 2006
@@ -0,0 +1,47 @@
+<variables>
+	<elementVar name="emptyVar"  xmlns:tns="http://foobar" >
+					<tns:ApplicationData>
+						<tns:empty/>
+                    </tns:ApplicationData>
+	</elementVar>
+
+   <elementVar name="reallyEmptyVar"  xmlns:tns="http://foobar" >
+					<tns:ApplicationData/>
+	</elementVar>
+	
+	<elementVar name="foo"  xmlns:tns="http://foobar" >
+					<tns:ApplicationData>
+                             <tns:ApplicationInfo>
+                                 <tns:senderId>string</tns:senderId>
+                                 <tns:senderName>string</tns:senderName>
+                                 <tns:applicationId>string</tns:applicationId>
+                                 <tns:applicationName>string</tns:applicationName>
+                                 <tns:applicationType>string</tns:applicationType>
+                                 <tns:applicationDate>string</tns:applicationDate>
+                                 <tns:applicationFee>string</tns:applicationFee>
+                                 <tns:comments>string</tns:comments>
+                             </tns:ApplicationInfo>
+                             <tns:AllocationInfo>
+                                 <tns:allocateApplication>boolean</tns:allocateApplication>
+                                 <tns:allocateTo>string</tns:allocateTo>
+                             </tns:AllocationInfo>
+                             <tns:AssessmentManagerInfo>
+                                 <tns:comments>string</tns:comments>
+                                 <tns:acceptApplication>boolean</tns:acceptApplication>
+                                 <tns:pathIndicators>
+                                     <tns:dasps>boolean</tns:dasps>
+                                     <tns:code>boolean</tns:code>
+                                     <tns:impact>boolean</tns:impact>
+                                     <tns:referralAgency>boolean</tns:referralAgency>
+                                     <tns:referralRequired>boolean</tns:referralRequired>
+                                 </tns:pathIndicators>
+                            </tns:AssessmentManagerInfo>
+                             <tns:PaymentInfo>
+                                 <tns:invoiceNumber>string</tns:invoiceNumber>
+                                 <tns:paymentMade>boolean</tns:paymentMade>
+                                 <tns:receiptNumber>string</tns:receiptNumber>
+                             </tns:PaymentInfo>
+                         </tns:ApplicationData>
+
+	</elementVar>
+</variables>
\ No newline at end of file

Propchange: incubator/ode/trunk/bpel-compiler/src/test/resources/variables.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ode/trunk/bpel-compiler/src/test/resources/variables.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/ode/trunk/bpel-compiler/src/test/resources/variables.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java?view=diff&rev=480289&r1=480288&r2=480289
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java Tue Nov 28 15:47:00 2006
@@ -42,6 +42,7 @@
 import org.apache.ode.bpel.pmapi.TInstanceStatus;
 import org.apache.ode.bpel.pmapi.TScopeInfo;
 import org.apache.ode.bpel.pmapi.TScopeRef;
+import org.apache.ode.bpel.o.OFailureHandling;
 import org.apache.ode.utils.DOMUtils;
 
 /**

Modified: incubator/ode/trunk/bpel-runtime/src/test/resources/atomic/same-transaction.bpel
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/resources/atomic/same-transaction.bpel?view=diff&rev=480289&r1=480288&r2=480289
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/test/resources/atomic/same-transaction.bpel (original)
+++ incubator/ode/trunk/bpel-runtime/src/test/resources/atomic/same-transaction.bpel Tue Nov 28 15:47:00 2006
@@ -30,18 +30,20 @@
              operation="instantiate"
              variable="request"
              createInstance="yes"/>
-    <invoke name="invoke"
-            partnerLink="resourcePartnerLink"
-            portType="tns:ResourcePortType"
-            operation="invoke"
-            inputVariable="request"
-            outputVariable="response"/>
-    <invoke name="invoke"
-            partnerLink="resourcePartnerLink"
-            portType="tns:ResourcePortType"
-            operation="invoke"
-            inputVariable="request"
-            outputVariable="response"/>
+    <scope atomic="yes">
+      <invoke name="invoke"
+              partnerLink="resourcePartnerLink"
+              portType="tns:ResourcePortType"
+              operation="invoke"
+              inputVariable="request"
+              outputVariable="response"/>
+      <invoke name="invoke"
+              partnerLink="resourcePartnerLink"
+              portType="tns:ResourcePortType"
+              operation="invoke"
+              inputVariable="request"
+              outputVariable="response"/>
+    </scope>
     <invoke name="response"
             partnerLink="instantiatingPartnerLink"
             portType="tns:ResponsePortType"

Modified: incubator/ode/trunk/distro-axis2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/distro-axis2/pom.xml?view=diff&rev=480289&r1=480288&r2=480289
==============================================================================
--- incubator/ode/trunk/distro-axis2/pom.xml (original)
+++ incubator/ode/trunk/distro-axis2/pom.xml Tue Nov 28 15:47:00 2006
@@ -33,10 +33,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-el-xpath20</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
             <artifactId>ode-bpel-obj</artifactId>
         </dependency>
 

Modified: incubator/ode/trunk/distro-axis2/src/main/assembly/assembly.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/distro-axis2/src/main/assembly/assembly.xml?view=diff&rev=480289&r1=480288&r2=480289
==============================================================================
--- incubator/ode/trunk/distro-axis2/src/main/assembly/assembly.xml (original)
+++ incubator/ode/trunk/distro-axis2/src/main/assembly/assembly.xml Tue Nov 28 15:47:00 2006
@@ -29,8 +29,6 @@
                 <include>org.apache.ode:ode-bpel-compiler</include>
                 <include>org.apache.ode:ode-bpel-bom</include>
                 <include>org.apache.ode:ode-bpel-api</include>
-                <include>org.apache.ode:ode-bpel-el-xpath10</include>
-                <include>org.apache.ode:ode-bpel-el-xpath20</include>
                 <include>org.apache.ode:ode-bpel-obj</include>
                 <include>org.apache.ode:ode-bpel-parser</include>
                 <include>org.apache.ode:ode-bpel-schemas</include>

Modified: incubator/ode/trunk/distro-jbi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/distro-jbi/pom.xml?view=diff&rev=480289&r1=480288&r2=480289
==============================================================================
--- incubator/ode/trunk/distro-jbi/pom.xml (original)
+++ incubator/ode/trunk/distro-jbi/pom.xml Tue Nov 28 15:47:00 2006
@@ -32,10 +32,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-el-xpath20</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
             <artifactId>ode-bpel-obj</artifactId>
         </dependency>
         <dependency>

Modified: incubator/ode/trunk/distro-jbi/src/main/assembly/assembly.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/distro-jbi/src/main/assembly/assembly.xml?view=diff&rev=480289&r1=480288&r2=480289
==============================================================================
--- incubator/ode/trunk/distro-jbi/src/main/assembly/assembly.xml (original)
+++ incubator/ode/trunk/distro-jbi/src/main/assembly/assembly.xml Tue Nov 28 15:47:00 2006
@@ -29,8 +29,6 @@
                 <include>org.apache.ode:ode-bpel-compiler</include>
                 <include>org.apache.ode:ode-bpel-bom</include>
                 <include>org.apache.ode:ode-bpel-api</include>
-                <include>org.apache.ode:ode-bpel-el-xpath10</include>
-                <include>org.apache.ode:ode-bpel-el-xpath20</include>
                 <include>org.apache.ode:ode-bpel-obj</include>
                 <include>org.apache.ode:ode-bpel-parser</include>
                 <include>org.apache.ode:ode-bpel-schemas</include>

Modified: incubator/ode/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/pom.xml?view=diff&rev=480289&r1=480288&r2=480289
==============================================================================
--- incubator/ode/trunk/pom.xml (original)
+++ incubator/ode/trunk/pom.xml Tue Nov 28 15:47:00 2006
@@ -102,7 +102,6 @@
     <modules>
         <module>jbi-examples</module>
         <module>tools-bin</module>
-
         <module>axis2</module>
         <module>axis2-war</module>
         <module>axis2-examples</module>
@@ -120,7 +119,6 @@
         <module>bpel-api</module>
         <module>bpel-dao</module>
         <module>bpel-api-jca</module>
-        <module>bpel-el-xpath20</module>
         <module>bpel-compiler</module>
         <module>bpel-runtime</module>
         <module>bpel-ql</module>
@@ -389,11 +387,6 @@
             <dependency>
                 <groupId>org.apache.ode</groupId>
                 <artifactId>ode-bpel-dd</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.ode</groupId>
-                <artifactId>ode-bpel-el-xpath20</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>