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 2008/05/20 00:57:26 UTC
svn commit: r658024 [3/4] - in /ode/trunk: ./
axis2-war/src/test/java/org/apache/ode/axis2/
axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/
axis2-war/src/test/java/org/apache/ode/axis2/management/
axis2-war/src/test/resources/TestHttpBinding/...
Added: ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingValidatorTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingValidatorTest.java?rev=658024&view=auto
==============================================================================
--- ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingValidatorTest.java (added)
+++ ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingValidatorTest.java Mon May 19 15:57:24 2008
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.axis2.httpbinding;
+
+import junit.framework.TestCase;
+
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.Definition;
+import javax.wsdl.Binding;
+import javax.xml.namespace.QName;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.axis2.httpbinding.HttpBindingValidator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Element;
+
+/**
+ * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
+ */
+public class HttpBindingValidatorTest extends TestCase {
+
+ private static final Log log = LogFactory.getLog(HttpBindingValidatorTest.class);
+
+ private Definition definition;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ URL wsdlURL = getClass().getResource("/http-binding-validator.wsdl");
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose", false);
+ definition = wsdlReader.readWSDL(wsdlURL.toURI().toString());
+ }
+
+ public void testAll(){
+ for (Iterator it = definition.getBindings().entrySet().iterator(); it.hasNext();) {
+ Map.Entry e = (Map.Entry) it.next();
+ QName name = (QName) e.getKey();
+ String localName = name.getLocalPart();
+ Binding binding = (Binding) e.getValue();
+ Element documentationElement = binding.getDocumentationElement();
+ if(documentationElement==null){
+ log.warn("Binding skipped : "+ localName +", <wsdl:documentation> missing ");
+ continue;
+ }
+ String doc = DOMUtils.getTextContent(documentationElement);
+ boolean shouldFail = doc.startsWith("shouldFail");
+ boolean shouldPass = doc.startsWith("shouldPass");
+ if(!shouldFail && !shouldPass) {
+ log.warn("Binding skipped : "+ localName +", <wsdl:documentation> content must start with 'OK' or 'KO'. ");
+ continue;
+ }
+
+ log.info("Testing Binding : "+localName);
+ String msg = localName + " : " + doc;
+ try {
+ new HttpBindingValidator(binding).validate();
+ assertTrue(msg, shouldPass);
+ } catch (IllegalArgumentException e1) {
+ msg += " / Exception Msg is : "+e1.getMessage();
+ assertTrue(msg, shouldFail);
+ }
+ }
+ }
+}
Added: ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java?rev=658024&view=auto
==============================================================================
--- ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java (added)
+++ ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java Mon May 19 15:57:24 2008
@@ -0,0 +1,349 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.axis2.httpbinding;
+
+import junit.framework.TestCase;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.ode.bpel.epr.MutableEndpoint;
+import org.apache.ode.bpel.iapi.BpelEngineException;
+import org.apache.ode.bpel.iapi.EndpointReference;
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.PartnerRoleChannel;
+import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.http.HTTPAddress;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
+ */
+public class HttpMethodBuilderTest extends TestCase {
+
+ protected Definition definition;
+
+ protected HttpMethodBuilder deliciousBuilder;
+ protected Binding deliciousBinding;
+ protected Port deliciousPort;
+
+ protected HttpMethodBuilder dummyBuilder;
+ protected Port dummyPort;
+ protected Binding dummyBinding;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ URL wsdlURL = getClass().getResource("/http-method-builder.wsdl");
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose", false);
+ definition = wsdlReader.readWSDL(wsdlURL.toURI().toString());
+
+ Service deliciousService = definition.getService(new QName("http://ode/bpel/unit-test.wsdl", "DeliciousService"));
+ deliciousPort = deliciousService.getPort("TagHttpPort");
+ deliciousBinding = deliciousPort.getBinding();
+ deliciousBuilder = new HttpMethodBuilder(deliciousBinding);
+
+ Service dummyService = definition.getService(new QName("http://ode/bpel/unit-test.wsdl", "DummyService"));
+ dummyPort = dummyService.getPort("DummyServiceHttpport");
+ dummyBinding = dummyPort.getBinding();
+ dummyBuilder = new HttpMethodBuilder(dummyBinding);
+
+ }
+
+ public void testGetTag() throws Exception {
+ String uri = ((HTTPAddress) deliciousPort.getExtensibilityElements().get(0)).getLocationURI();
+ String expectedUri = uri + "/tag/java";
+ Element msgEl;
+ {
+ Document odeMsg = DOMUtils.newDocument();
+ msgEl = odeMsg.createElementNS(null, "message");
+ Element partEl = odeMsg.createElementNS(null, "TagPart");
+ partEl.setTextContent("java");
+ odeMsg.appendChild(msgEl);
+ msgEl.appendChild(partEl);
+ }
+
+ MockMessageExchange odeMex = new MockMessageExchange();
+ odeMex.op = deliciousBinding.getBindingOperation("getTag", null, null).getOperation();
+ odeMex.req = new MockMessage(msgEl);
+ odeMex.epr = new MockEPR(uri);
+ HttpMethod httpMethod = deliciousBuilder.buildHttpMethod(odeMex);
+
+
+ assertTrue("GET".equalsIgnoreCase(httpMethod.getName()));
+ assertTrue(expectedUri.equalsIgnoreCase(httpMethod.getURI().toString()));
+ }
+
+ public void testGetTagWithNoPart() throws Exception {
+ String uri = ((HTTPAddress) deliciousPort.getExtensibilityElements().get(0)).getLocationURI();
+ Element msgEl;
+ {
+ Document odeMsg = DOMUtils.newDocument();
+ msgEl = odeMsg.createElementNS(null, "message");
+ odeMsg.appendChild(msgEl);
+ }
+
+ MockMessageExchange odeMex = new MockMessageExchange();
+ odeMex.op = deliciousBinding.getBindingOperation("getTag", null, null).getOperation();
+ odeMex.req = new MockMessage(msgEl);
+ odeMex.epr = new MockEPR(uri);
+ try {
+ HttpMethod httpMethod = deliciousBuilder.buildHttpMethod(odeMex);
+ fail("IllegalArgumentException expected because message element is empty.");
+ } catch (IllegalArgumentException e) {
+ // expected behavior
+ }
+ }
+
+ public void testHello() throws Exception {
+ String uri = ((HTTPAddress) dummyPort.getExtensibilityElements().get(0)).getLocationURI();
+ String expectedUri = uri + "/" + "DummyService/hello";
+ Element msgEl, helloEl;
+ {
+ Document odeMsg = DOMUtils.newDocument();
+ msgEl = odeMsg.createElementNS(null, "message");
+ Element partEl = odeMsg.createElementNS(null, "parameters");
+ odeMsg.appendChild(msgEl);
+ msgEl.appendChild(partEl);
+ helloEl = odeMsg.createElementNS(null, "hello");
+ helloEl.setTextContent("This is a test. How is it going so far?");
+ partEl.appendChild(helloEl);
+ }
+
+ MockMessageExchange odeMex = new MockMessageExchange();
+ odeMex.op = dummyBinding.getBindingOperation("hello", null, null).getOperation();
+ odeMex.req = new MockMessage(msgEl);
+ odeMex.epr = new MockEPR(uri);
+ HttpMethod httpMethod = dummyBuilder.buildHttpMethod(odeMex);
+ assertTrue("POST".equalsIgnoreCase(httpMethod.getName()));
+ assertEquals("Generated URI does not match", expectedUri, httpMethod.getURI().toString());
+
+ byte[] content = ((ByteArrayRequestEntity) ((PostMethod) httpMethod).getRequestEntity()).getContent();
+ String b = new String(content);
+ assertEquals("Invalid body in generated http query", DOMUtils.domToString(helloEl), b);
+ }
+
+
+ class MockEPR implements EndpointReference, MutableEndpoint {
+ String url;
+
+ MockEPR(String url) {
+ this.url = url;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ // other useless methods
+ public Document toXML() {
+ return null;
+ }
+
+ public boolean accept(Node node) {
+ return false;
+ }
+
+ public void fromMap(Map eprMap) {
+
+ }
+
+ public void set(Node node) {
+
+ }
+
+ public Map toMap() {
+ return null;
+ }
+ }
+
+ class MockMessage implements Message {
+ Element elt;
+
+ MockMessage(Element elt) {
+ this.elt = elt;
+ }
+
+ public Element getMessage() {
+ return elt;
+ }
+
+ // other useless methods
+ public Element getHeaderPart(String partName) {
+ return null;
+ }
+
+ public Map<String, Element> getHeaderParts() {
+ return null;
+ }
+
+ public Element getPart(String partName) {
+ return null;
+ }
+
+ public List<String> getParts() {
+ return null;
+ }
+
+ public QName getType() {
+ return null;
+ }
+
+ public void setHeaderPart(String name, Element content) {
+
+ }
+
+ public void setMessage(Element msg) {
+
+ }
+
+ public void setPart(String partName, Element content) {
+
+ }
+ }
+
+ class MockMessageExchange implements PartnerRoleMessageExchange {
+ Operation op;
+ Message req;
+ EndpointReference epr;
+
+ public Operation getOperation() {
+ return op;
+ }
+
+ public Message getRequest() {
+ return req;
+ }
+
+ public EndpointReference getEndpointReference() throws BpelEngineException {
+ return epr;
+ }
+
+ // other useless methods
+ public QName getCaller() {
+ return null;
+ }
+
+ public PartnerRoleChannel getChannel() {
+ return null;
+ }
+
+ public EndpointReference getMyRoleEndpointReference() {
+ return null;
+ }
+
+ public void reply(Message response) throws BpelEngineException {
+
+ }
+
+ public void replyAsync() {
+
+ }
+
+ public void replyOneWayOk() {
+
+ }
+
+ public void replyWithFailure(FailureType type, String description, Element details) throws BpelEngineException {
+
+ }
+
+ public void replyWithFault(QName faultType, Message outputFaultMessage) throws BpelEngineException {
+
+ }
+
+ public Message createMessage(QName msgType) {
+ return null;
+ }
+
+ public QName getFault() {
+ return null;
+ }
+
+ public String getFaultExplanation() {
+ return null;
+ }
+
+ public Message getFaultResponse() {
+ return null;
+ }
+
+ public String getMessageExchangeId() throws BpelEngineException {
+ return null;
+ }
+
+ public MessageExchangePattern getMessageExchangePattern() {
+ return null;
+ }
+
+ public String getOperationName() throws BpelEngineException {
+ return null;
+ }
+
+ public PortType getPortType() {
+ return null;
+ }
+
+ public String getProperty(String key) {
+ return null;
+ }
+
+ public Set<String> getPropertyNames() {
+ return null;
+ }
+
+ public Message getResponse() {
+ return null;
+ }
+
+ public Status getStatus() {
+ return null;
+ }
+
+ public boolean isTransactionPropagated() throws BpelEngineException {
+ return false;
+ }
+
+ public void release() {
+
+ }
+
+ public void setProperty(String key, String value) {
+
+ }
+ }
+}
Added: ode/trunk/axis2/src/test/java/org/apache/ode/axis2/util/UrlEncodedTransformerTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/util/UrlEncodedTransformerTest.java?rev=658024&view=auto
==============================================================================
--- ode/trunk/axis2/src/test/java/org/apache/ode/axis2/util/UrlEncodedTransformerTest.java (added)
+++ ode/trunk/axis2/src/test/java/org/apache/ode/axis2/util/UrlEncodedTransformerTest.java Mon May 19 15:57:24 2008
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.axis2.util;
+
+import junit.framework.TestCase;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.ode.utils.DOMUtils;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
+ */
+public class UrlEncodedTransformerTest extends TestCase {
+ protected URLEncodedTransformer transformer= new URLEncodedTransformer();
+
+
+ public void testSimple(){
+ Document doc = DOMUtils.newDocument();
+ Map<String, Element> m = new HashMap<String, Element>();
+ Element element = doc.createElement("part1");
+ element.setTextContent("42 3.14159");
+ m.put("part1", element);
+
+ element = doc.createElement("part2");
+ element.setTextContent("hello word @#$% &*");
+ m.put("part2", element);
+
+ element = doc.createElement("emptyPart");
+ m.put("emptyPart", element);
+
+ String res = transformer.transform(m);
+ assertTrue(res.contains("part1=42+3.14159"));
+ assertTrue(res.contains("part2=hello+word+%40%23%24%25+%26*"));
+ assertTrue(res.contains("emptyPart="));
+ assertTrue(res.split("&").length==m.size());
+ }
+
+
+ public void testComplexType() {
+ Document doc = DOMUtils.newDocument();
+ Element element = doc.createElement("part1");
+ element.appendChild(doc.createElement("kid"));
+ Map<String, Element> m = new HashMap<String, Element>();
+ m.put("part1", element);
+
+ try {
+ transformer.transform(m);
+ fail("IllegalArgumentException expected because a complex type is passed.");
+ } catch (IllegalArgumentException e) {
+ // expected behavior
+ }
+
+ }
+}
Added: ode/trunk/axis2/src/test/java/org/apache/ode/axis2/util/UrlReplacementTransformerTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/util/UrlReplacementTransformerTest.java?rev=658024&view=auto
==============================================================================
--- ode/trunk/axis2/src/test/java/org/apache/ode/axis2/util/UrlReplacementTransformerTest.java (added)
+++ ode/trunk/axis2/src/test/java/org/apache/ode/axis2/util/UrlReplacementTransformerTest.java Mon May 19 15:57:24 2008
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.axis2.util;
+
+import junit.framework.TestCase;
+import org.apache.ode.axis2.util.UrlReplacementTransformer;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
+ */
+public class UrlReplacementTransformerTest extends TestCase {
+
+ //<http:operation location="o1/A(part1)B(part2)/(part3)"/>
+ private String baseUrl = "o1/A(part1)B(part2)/(part3)";
+
+ public void testRegularCases() {
+ String[][] a = new String[][]{
+ new String[]{"with alphabetical chars", baseUrl, "o1/AtutuBtiti/toto", "part1", "tutu", "part2", "titi", "part3", "toto"}
+ , new String[]{"parts are ends", "(part1)B(part2)/(part3)", "3B14/159", "part1", "3", "part2", "14", "part3", "159"}
+ , new String[]{"a single part", "(part1)", "314159", "part1", "314159"}
+ , new String[]{"parts surrounded with ()", "o1/A((part1))B((part2))/((part3))", "o1/A(3)B(14)/(159)", "part1", "3", "part2", "14", "part3", "159"}
+ , new String[]{"with numeric chars", baseUrl, "o1/A3B14/159", "part1", "3", "part2", "14", "part3", "159"}
+ , new String[]{"with empty values", baseUrl, "o1/AB/", "part1", "", "part2", "", "part3", ""}
+ , new String[]{"with special chars", baseUrl, "o1/AWhatB$10,000/~!@#$%^&*()_+=-`[]{}|\\.", "part1", "What", "part2", "$10,000", "part3", "~!@#$%^&*()_+=-`[]{}|\\."}
+ , new String[]{"with values containing key names", baseUrl, "o1/Avalue_of_part1_is_(part2)_and_should_not_be_replacedBsame_for_part2(part3)/foo", "part1", "value_of_part1_is_(part2)_and_should_not_be_replaced", "part2", "same_for_part2(part3)", "part3", "foo"}
+ };
+
+ Document doc = DOMUtils.newDocument();
+ for (String[] data : a) {
+ // convert into map
+ Map<String, Element> parts = new HashMap<String, Element>();
+ for (int k = 3; k < data.length; k = k + 2) {
+ Element element = doc.createElement(data[k]);
+ element.setTextContent(data[k + 1]);
+ parts.put(data[k], element);
+ }
+ UrlReplacementTransformer encoder = new UrlReplacementTransformer(parts.keySet());
+ assertEquals(data[0], data[2], encoder.transform(data[1], parts));
+ }
+
+ }
+
+ public void testMissingPartPatterns() {
+ try {
+ Map<String, Element> map = new HashMap<String, Element>();
+ map.put("part1", null);
+ UrlReplacementTransformer encoder = new UrlReplacementTransformer(map.keySet());
+ encoder.transform("", map);
+ fail("Exception expected! Missing Part Patterns in URI");
+ } catch (IllegalArgumentException e) {
+ // expected behavior
+ }
+ }
+
+ public void testComplexType() {
+ Document doc = DOMUtils.newDocument();
+ Element element = doc.createElement("part1");
+ element.appendChild(doc.createElement("kid"));
+ Map<String, Element> m = new HashMap<String, Element>();
+ m.put("part1", element);
+
+ UrlReplacementTransformer encoder = new UrlReplacementTransformer(m.keySet());
+ try {
+ encoder.transform("(part1)", m);
+ fail("IllegalArgumentException expected because a complex type is passed.");
+ } catch (IllegalArgumentException e) {
+ // expected behavior
+ }
+ }
+
+}
Added: ode/trunk/axis2/src/test/resources/http-binding-validator.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/resources/http-binding-validator.wsdl?rev=658024&view=auto
==============================================================================
--- ode/trunk/axis2/src/test/resources/http-binding-validator.wsdl (added)
+++ ode/trunk/axis2/src/test/resources/http-binding-validator.wsdl Mon May 19 15:57:24 2008
@@ -0,0 +1,404 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:ns0="http://axis2.ode.apache.org/xsd"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns1="http://axis2.ode.apache.org"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ targetNamespace="http://axis2.ode.apache.org">
+ <wsdl:message name="helloRequest">
+ <wsdl:part name="TestPart" type="xs:string"/>
+ </wsdl:message>
+ <wsdl:message name="helloResponse">
+ <wsdl:part name="TestPart" type="xs:string"/>
+ </wsdl:message>
+ <wsdl:portType name="DummyServicePortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="ns1:helloRequest" wsaw:Action="urn:hello"/>
+ <wsdl:output message="ns1:helloResponse" wsaw:Action="urn:helloResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="DummyServiceSOAP11Binding" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldFail # HttpbindingValidator should fail because this port used soap:binding
+ </wsdl:documentation>
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="urn:hello" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <!-- ###################################### -->
+ <!-- Supported HTTP Method tests-->
+ <!-- ###################################### -->
+ <wsdl:binding name="DummyServiceHttpBinding_get" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # GET should be supported
+ </wsdl:documentation>
+ <http:binding verb="GET"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <http:urlEncoded/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_post" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # POST should be supported
+ </wsdl:documentation>
+ <http:binding verb="POST"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_delete" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # DELETE should be supported
+ </wsdl:documentation>
+ <http:binding verb="DELETE"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <http:urlEncoded/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_put" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # PUT should be supported
+ </wsdl:documentation>
+ <http:binding verb="PUT"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_head" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldFail # only GET, DELETE, PUT, POST supported
+ </wsdl:documentation>
+ <http:binding verb="HEAD"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <!-- ###################################### -->
+ <!-- PUT tests-->
+ <!-- ###################################### -->
+ <wsdl:binding name="DummyServiceHttpBinding_put+text/xml" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # PUT+text/xml should be supported
+ </wsdl:documentation>
+ <http:binding verb="PUT"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_put+urlEncoded" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # PUT should be able to use urlEncoded
+ </wsdl:documentation>
+ <http:binding verb="PUT"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <http:urlEncoded/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_put+form-urlencoded" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # application/x-www-form-urlencoded should be supported for PUT
+ </wsdl:documentation>
+ <http:binding verb="PUT"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_put+whatever-content-type" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldFail # Only application/x-www-form-urlencoded and text/xml should be supported
+ </wsdl:documentation>
+ <http:binding verb="PUT"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="whatever-content-type" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <!-- ###################################### -->
+ <!-- POST tests-->
+ <!-- ###################################### -->
+ <wsdl:binding name="DummyServiceHttpBinding_post+text/xml" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # POST+text/xml should be supported
+ </wsdl:documentation>
+ <http:binding verb="POST"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_post+urlEncoded" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # POST should be able to use urlEncoded
+ </wsdl:documentation>
+ <http:binding verb="POST"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <http:urlEncoded/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_post+form-urlencoded" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # application/x-www-form-urlencoded should be supported for POST
+ </wsdl:documentation>
+ <http:binding verb="POST"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_post+whatever-content-type" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldFail # Only application/x-www-form-urlencoded and text/xml should be supported
+ </wsdl:documentation>
+ <http:binding verb="POST"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="whatever-content-type" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <!-- ###################################### -->
+ <!-- GET tests-->
+ <!-- ###################################### -->
+ <wsdl:binding name="DummyServiceHttpBinding_get+whatever-content-type" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldFail # GET only supports urlReplacement and urlEncoded
+ </wsdl:documentation>
+ <http:binding verb="GET"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_get+urlEncoded" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # GET should support urlEncoded
+ </wsdl:documentation>
+ <http:binding verb="GET"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <http:urlEncoded/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <!-- ###################################### -->
+ <!-- DELETE tests-->
+ <!-- ###################################### -->
+ <wsdl:binding name="DummyServiceHttpBinding_delete+whatever-content-type" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldFail # DELETE only supports urlReplacement and urlEncoded
+ </wsdl:documentation>
+ <http:binding verb="DELETE"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_delete+urlEncoded" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # DELETE should support urlEncoded
+ </wsdl:documentation>
+ <http:binding verb="DELETE"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <http:urlEncoded/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <!-- ###################################### -->
+ <!-- urlReplacement tests-->
+ <!-- ###################################### -->
+ <wsdl:binding name="DummyServiceHttpBinding_post+urlReplacement" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # POST can use urlReplacement
+ </wsdl:documentation>
+ <http:binding verb="POST"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello/(TestPart)"/>
+ <wsdl:input>
+ <http:urlReplacement/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_put+urlReplacement" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # PUT can use urlReplacement
+ </wsdl:documentation>
+ <http:binding verb="PUT"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello/(TestPart)"/>
+ <wsdl:input>
+ <http:urlReplacement/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_get+urlReplacement" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # GET should support urlReplacement
+ </wsdl:documentation>
+ <http:binding verb="GET"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello/(TestPart)"/>
+ <wsdl:input>
+ <http:urlReplacement/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_delete+urlReplacement" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldPass # DELETE should support urlReplacement
+ </wsdl:documentation>
+ <http:binding verb="DELETE"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello/(TestPart)"/>
+ <wsdl:input>
+ <http:urlReplacement/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_get+urlReplacement+missing_part" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldFail # When urlReplacement used, all message parts must be in the url pattern
+ </wsdl:documentation>
+ <http:binding verb="GET"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <http:urlReplacement/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="DummyServiceHttpBinding_get+urlReplacement+twice_the_same_part" type="ns1:DummyServicePortType">
+ <wsdl:documentation>
+ shouldFail # When urlReplacement used, all message parts must be exactly ONCE in the url pattern
+ </wsdl:documentation>
+ <http:binding verb="GET"/>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello/(TestPart)/(TestPart)"/>
+ <wsdl:input>
+ <http:urlReplacement/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <!-- no <service> tags needed -->
+</wsdl:definitions>
Added: ode/trunk/axis2/src/test/resources/http-method-builder.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/resources/http-method-builder.wsdl?rev=658024&view=auto
==============================================================================
--- ode/trunk/axis2/src/test/resources/http-method-builder.wsdl (added)
+++ ode/trunk/axis2/src/test/resources/http-method-builder.wsdl Mon May 19 15:57:24 2008
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<wsdl:definitions
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <wsdl:service name="DummyService">
+ <wsdl:port name="DummyServiceHttpport" binding="tns:DummyServiceHttpBinding">
+ <http:address location="http://localhost:8080/processes/DummyService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <wsdl:portType name="DummyServicePortType">
+ <wsdl:operation name="faultTest">
+ <wsdl:input message="tns:faultTestRequest"/>
+ <wsdl:output message="tns:faultTestResponse"/>
+ <wsdl:fault message="tns:DummyException" name="DummyException"/>
+ </wsdl:operation>
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:helloRequest"/>
+ <wsdl:output message="tns:helloResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="DummyServiceHttpBinding" type="tns:DummyServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="faultTest">
+ <http:operation location="DummyService/faultTest"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="hello">
+ <http:operation location="DummyService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+
+ <wsdl:types>
+ <xsd:schema xmlns:ns="http://axis2.ode.apache.org" attributeFormDefault="qualified"
+ elementFormDefault="unqualified" targetNamespace="http://axis2.ode.apache.org">
+
+ <xsd:element name="DummyException">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="reason" nillable="true" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="faultTest">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="in" nillable="true" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="faultTestResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="return" nillable="true" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="hello">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="in" nillable="true" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="helloResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="return" nillable="true" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="faultTestRequest">
+ <wsdl:part name="parameters" element="tns:faultTest"/>
+ </wsdl:message>
+ <wsdl:message name="faultTestResponse">
+ <wsdl:part name="parameters" element="tns:faultTestResponse"/>
+ </wsdl:message>
+ <wsdl:message name="DummyException">
+ <wsdl:part name="parameters" element="tns:DummyException"/>
+ </wsdl:message>
+ <wsdl:message name="helloRequest">
+ <wsdl:part name="parameters" element="tns:hello"/>
+ </wsdl:message>
+ <wsdl:message name="helloResponse">
+ <wsdl:part name="parameters" element="tns:helloResponse"/>
+ </wsdl:message>
+
+
+
+ <!--
+ ++ GET with url replacement
+ del.icio.us
+ http://del.icio.us/popular/{tag}
+ http://del.icio.us/tag/{tag}
+ -->
+ <wsdl:message name="TagRequest">
+ <wsdl:part name="TagPart" type="xsd:string"/>
+ </wsdl:message>
+ <wsdl:message name="TagResponse">
+ <wsdl:part name="TagPart" element="RDF"/>
+ </wsdl:message>
+
+ <wsdl:portType name="TagType">
+ <wsdl:operation name="getTag">
+ <wsdl:input message="tns:TagRequest"/>
+ <wsdl:output message="tns:TagResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="TagHttpBinding" type="tns:TagType">
+ <http:binding verb="GET"/>
+ <wsdl:operation name="getTag">
+ <http:operation location="tag/(TagPart)"/>
+ <wsdl:input>
+ <http:urlReplacement/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="DeliciousService">
+ <wsdl:port name="TagHttpPort" binding="tns:TagHttpBinding">
+ <http:address location="http://feeds.delicious.com/rss"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+
Modified: ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExpressionLanguage.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExpressionLanguage.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExpressionLanguage.java (original)
+++ ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExpressionLanguage.java Mon May 19 15:57:24 2008
@@ -34,4 +34,13 @@
if (properties != null)
this.properties.putAll(properties);
}
+
+ public boolean equals(Object obj) {
+ if (obj instanceof OExpressionLanguage) return ((OExpressionLanguage)obj).expressionLanguageUri.equals(expressionLanguageUri);
+ else return super.equals(obj);
+ }
+
+ public int hashCode() {
+ return expressionLanguageUri.hashCode();
+ }
}
Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java Mon May 19 15:57:24 2008
@@ -936,9 +936,22 @@
*
* @return
*/
- ReplacementMap getReplacementMap() {
+ ReplacementMap getReplacementMap(QName processName) {
assert _hydrationLatch.isLatched(1);
- return _replacementMap;
+ if (processName.equals(_pid)) return _replacementMap;
+ else
+ try {
+ // We're asked for an older version of this process, fetching it
+ OProcess oprocess = _server.getOProcess(processName);
+ // Older versions may ventually need more expression languages
+ registerExprLang(oprocess);
+
+ return new ReplacementMapImpl(oprocess);
+ } catch (Exception e) {
+ String errmsg = "Error reloading compiled process " + _pid + "; the file appears to be corrupted.";
+ __log.error(errmsg);
+ throw new BpelEngineException(errmsg, e);
+ }
}
public boolean isInMemory() {
@@ -1137,13 +1150,11 @@
doDehydrate();
}
};
-
_transitions[1] = new Runnable() {
public void run() {
doHydrate();
}
};
-
}
private void doDehydrate() {
@@ -1169,17 +1180,8 @@
_replacementMap = new ReplacementMapImpl(_oprocess);
// Create an expression language registry for this process
- ExpressionLanguageRuntimeRegistry elangRegistry = new ExpressionLanguageRuntimeRegistry();
- for (OExpressionLanguage elang : _oprocess.expressionLanguages) {
- try {
- elangRegistry.registerRuntime(elang);
- } catch (ConfigurationException e) {
- String msg = __msgs.msgExpLangRegistrationError(elang.expressionLanguageUri, elang.properties);
- __log.error(msg, e);
- throw new BpelEngineException(msg, e);
- }
- }
- _expLangRuntimeRegistry = elangRegistry;
+ _expLangRuntimeRegistry = new ExpressionLanguageRuntimeRegistry();
+ registerExprLang(_oprocess);
// Checking for registered extension bundles, throw an exception when
// a "mustUnderstand" extension is not available
@@ -1355,7 +1357,7 @@
/**
* Handle in-line P2P responses. Called from the child's transaction.
*
- * @param myrolemex
+ * @param prolemex
*/
private void p2pWakeup(final MessageExchangeDAO prolemex) {
@@ -1373,4 +1375,16 @@
}
}
+ private void registerExprLang(OProcess oprocess) {
+ for (OExpressionLanguage elang : oprocess.expressionLanguages) {
+ try {
+ _expLangRuntimeRegistry.registerRuntime(elang);
+ } catch (ConfigurationException e) {
+ String msg = __msgs.msgExpLangRegistrationError(elang.expressionLanguageUri, elang.properties);
+ __log.error(msg, e);
+ throw new BpelEngineException(msg, e);
+ }
+ }
+ }
+
}
\ No newline at end of file
Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Mon May 19 15:57:24 2008
@@ -149,7 +149,7 @@
if (__log.isDebugEnabled())
__log.debug("CACHE HIT: Using cached state #" + dao.getExecutionStateCounter() + " to resume instance " + dao.getInstanceId());
_soup = (ExecutionQueueImpl) cachedState;
- _soup.setReplacementMap(_bpelProcess.getReplacementMap());
+ _soup.setReplacementMap(_bpelProcess.getReplacementMap(dao.getProcess().getProcessId()));
_vpu.setContext(_soup);
} else {
if (__log.isDebugEnabled())
@@ -188,7 +188,7 @@
_vpu = new JacobVPU();
_vpu.registerExtension(BpelRuntimeContext.class, this);
_soup = soup;
- _soup.setReplacementMap(_bpelProcess.getReplacementMap());
+ _soup.setReplacementMap(_bpelProcess.getReplacementMap(dao.getProcess().getProcessId()));
_vpu.setContext(_soup);
if (BpelProcess.__log.isDebugEnabled()) {
__log.debug("BpelRuntimeContextImpl created for instance " + _iid + ". INDEXED STATE=" + _soup.getIndex());
Modified: ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java (original)
+++ ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java Mon May 19 15:57:24 2008
@@ -48,6 +48,7 @@
import org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl;
import org.apache.ode.il.EmbeddedGeronimoFactory;
import org.apache.ode.il.MockScheduler;
+import org.apache.ode.il.config.OdeConfigProperties;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.DOMUtils;
@@ -95,7 +96,7 @@
_server.setDaoConnectionFactory(_daoCF);
if (_scheduler == null)
throw new RuntimeException("No scheduler");
- _store = new ProcessStoreImpl(_dataSource, "jpa", true);
+ _store = new ProcessStoreImpl(_dataSource,"jpa", new OdeConfigProperties(new Properties(), ""), true);
_server.setTransactionManager(_txManager);
_server.setScheduler(_scheduler);
_server.setEndpointReferenceContext(createEndpointReferenceContext());
Modified: ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java (original)
+++ ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java Mon May 19 15:57:24 2008
@@ -21,13 +21,7 @@
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -55,6 +49,7 @@
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.il.config.OdeConfigProperties;
import org.hsqldb.jdbc.jdbcDataSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -115,14 +110,14 @@
private DataSource _inMemDs;
public ProcessStoreImpl() {
- this(null, "", true);
+ this(null, "", new OdeConfigProperties(new Properties(), ""), true);
}
- public ProcessStoreImpl(DataSource ds, String persistenceType, boolean auto) {
+ public ProcessStoreImpl(DataSource ds, String persistenceType, OdeConfigProperties props, boolean auto) {
if (ds != null) {
// ugly hack
if (persistenceType.toLowerCase().indexOf("hib") != -1)
- _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, auto);
+ _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, props.getProperties(), auto);
else
_cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, auto);
} else {
@@ -130,7 +125,7 @@
// database. Makes testing a bit simpler.
DataSource hsqlds = createInternalDS(_guid);
if ("hibernate".equalsIgnoreCase(persistenceType))
- _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, auto);
+ _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, props.getProperties(), auto);
else
_cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, auto);
_inMemDs = hsqlds;
@@ -406,8 +401,7 @@
public void setRetiredPackage(String packageName, boolean retired) {
DeploymentUnitDir duDir = _deploymentUnits.get(packageName);
- if (duDir == null)
- throw new ContextException("Could not find package " + packageName);
+ if (duDir == null) throw new ContextException("Could not find package " + packageName);
for (QName processName : duDir.getProcessNames()) {
setState(toPid(processName, duDir.getVersion()), retired ? ProcessState.RETIRED : ProcessState.ACTIVE);
}
Modified: ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java (original)
+++ ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java Mon May 19 15:57:24 2008
@@ -78,24 +78,27 @@
final SessionFactory _sessionFactory;
- public DbConfStoreConnectionFactory(DataSource ds, boolean auto) {
+ public DbConfStoreConnectionFactory(DataSource ds, Properties initialProps, boolean auto) {
_ds = ds;
- Properties properties = new Properties();
+ // Don't want to pollute original properties
+ Properties properties = new Properties(initialProps);
__log.debug("using data source: " + ds);
_dataSources.put(_guid, ds);
properties.put("guid", _guid);
properties.put(Environment.CONNECTION_PROVIDER, DataSourceConnectionProvider.class.getName());
- try {
- properties.put(Environment.DIALECT, guessDialect(_ds));
- } catch (Exception ex) {
- String errmsg = __msgs.msgOdeInitHibernateDialectDetectFailed();
- __log.error(errmsg, ex);
- throw new BpelEngineException(errmsg, ex);
+ if (properties.get(Environment.DIALECT) == null) {
+ try {
+ properties.put(Environment.DIALECT, guessDialect(_ds));
+ } catch (Exception ex) {
+ String errmsg = __msgs.msgOdeInitHibernateDialectDetectFailed();
+ __log.error(errmsg, ex);
+ throw new BpelEngineException(errmsg, ex);
+ }
}
-
+
if (auto) {
properties.put(Environment.HBM2DDL_AUTO, "create-drop");
}
Modified: ode/trunk/bpel-store/src/test/java/org/apache/ode/store/hib/DaoTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/test/java/org/apache/ode/store/hib/DaoTest.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/test/java/org/apache/ode/store/hib/DaoTest.java (original)
+++ ode/trunk/bpel-store/src/test/java/org/apache/ode/store/hib/DaoTest.java Mon May 19 15:57:24 2008
@@ -24,7 +24,7 @@
import org.apache.ode.store.DeploymentUnitDAO;
import org.apache.ode.store.ProcessConfDAO;
import org.hsqldb.jdbc.jdbcDataSource;
-
+import java.util.Properties;
import javax.xml.namespace.QName;
public class DaoTest extends TestCase {
@@ -38,7 +38,7 @@
hsqlds.setUser("sa");
hsqlds.setPassword("");
- cf = new DbConfStoreConnectionFactory(hsqlds, true);
+ cf = new DbConfStoreConnectionFactory(hsqlds, new Properties(), true);
}
public void tearDown() throws Exception {
Modified: ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java (original)
+++ ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java Mon May 19 15:57:24 2008
@@ -53,6 +53,7 @@
import org.apache.ode.bpel.runtime.extension.AbstractExtensionBundle;
import org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl;
import org.apache.ode.il.MockScheduler;
+import org.apache.ode.il.config.OdeConfigProperties;
import org.apache.ode.store.ProcessConfImpl;
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.DOMUtils;
@@ -122,7 +123,7 @@
_server.setMessageExchangeContext(mexContext);
_server.setTransactionManager(_txm);
scheduler.setJobProcessor(_server);
- store = new ProcessStoreImpl(null, "jpa", true);
+ store = new ProcessStoreImpl(null, "jpa", new OdeConfigProperties(new Properties(), ""), true);
// not needed: we do eclipcitly in doDeployment
// store.registerListener(new ProcessStoreListener() {
// public void onProcessStoreEvent(ProcessStoreEvent event) {
@@ -153,17 +154,14 @@
}
}
- if (em != null)
- em.close();
- if (emf != null)
- emf.close();
+ if (em != null) em.close();
+ if (emf != null) emf.close();
_server.stop();
_failures = null;
_deployed = null;
_deployments = null;
_invocations = null;
-
}
public void registerExtensionBundle(AbstractExtensionBundle bundle) {
@@ -297,7 +295,7 @@
/**
* Do all the registered deployments.
- *
+ *
* @param d
*/
protected void doDeployment(Deployment d) {
@@ -361,8 +359,10 @@
testThreads.add(t);
}
- for (Thread testThread : testThreads)
+ for (Thread testThread : testThreads) {
testThread.start();
+ if (testThreads.size() > 0) Thread.sleep(2000);
+ }
for (Thread testThread : testThreads)
testThread.join();
@@ -455,9 +455,9 @@
/**
* Represents a test deployement.
- *
+ *
* @author mszefler
- *
+ *
*/
public static class Deployment {
/** The directory containing the deploy.xml and artefacts. */
@@ -477,7 +477,7 @@
/**
* Represents an test invocation of the BPEL engine.
- *
+ *
* @author mszefler
*/
public static class Invocation {
Modified: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/MessageRouting20Test.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/MessageRouting20Test.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/MessageRouting20Test.java (original)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/MessageRouting20Test.java Mon May 19 15:57:24 2008
@@ -23,7 +23,7 @@
public class MessageRouting20Test extends BPELTestAbstract {
- @Ignore("fix test bed for handling ASYNC mex") @Test public void testCorrelation() throws Throwable {
+ @Test public void testCorrelation() throws Throwable {
go("/bpel/2.0/TestCorrelation");
}
Modified: ode/trunk/bpel-test/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/log4j.properties?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/log4j.properties (original)
+++ ode/trunk/bpel-test/src/test/resources/log4j.properties Mon May 19 15:57:24 2008
@@ -15,17 +15,19 @@
# limitations under the License.
#
-# Set root logger level to WARN and its only appender to CONSOLE
-log4j.rootLogger=WARN, CONSOLE
-
-# log4j properties to work with commandline tools.
-log4j.category.org.mortbay=ERROR
-log4j.category.org.hibernate.type=WARN
-log4j.category.org.objectweb=ERROR
-log4j.category.org.apache.ode=DEBUG
-log4j.category.org.apache.ode.bpel.runtime=DEBUG
-
-# Console appender
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=WARN, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=ERROR
+log4j.category.org.hibernate.type=WARN
+log4j.category.org.objectweb=ERROR
+log4j.category.org.apache.ode.axis2=DEBUG
+log4j.category.org.apache.ode.bpel.engine=DEBUG
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=DEBUG
+log4j.category.org.apache.ode.bpel.epr=INFO
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
Modified: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/BpelDAOConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/BpelDAOConnectionFactoryImpl.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/BpelDAOConnectionFactoryImpl.java (original)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/BpelDAOConnectionFactoryImpl.java Mon May 19 15:57:24 2008
@@ -68,7 +68,7 @@
/**
* @see org.apache.ode.bpel.dao.BpelDAOConnectionFactory#init(java.util.Properties)
*/
- public void init(Properties properties) {
+ public void init(Properties initialProps) {
if (_ds == null) {
String errmsg = "setDataSource() not called!";
__log.fatal(errmsg);
@@ -81,8 +81,9 @@
throw new IllegalStateException(errmsg);
}
- if (properties == null)
- properties = new Properties();
+ if (initialProps == null) initialProps = new Properties();
+ // Don't want to pollute original properties
+ Properties properties = new Properties(initialProps);
// Note that we don't allow the following properties to be overriden by
// the client.
Modified: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java (original)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java Mon May 19 15:57:24 2008
@@ -41,6 +41,8 @@
import org.hibernate.LockMode;
import org.hibernate.Query;
+import javax.xml.namespace.QName;
+
/**
* Hibernate-based {@link CorrelatorDAO} implementation.
*/
@@ -53,12 +55,11 @@
private static final String QRY_MESSAGE = " where this.correlationKey = ?".intern();
/** filter for finding a matching selector. */
- private static final String FLTR_SELECTORS = " where this.correlationKey = ?" + " and " +
- "(this.instance.state = " + ProcessState.STATE_ACTIVE + " or this.instance.state = "
- + ProcessState.STATE_READY + ")".intern();
+ private static final String FLTR_SELECTORS = ("from " + HCorrelatorSelector.class.getName()
+ + " hs where hs.correlationKey = ? and hs.processType = ? and hs.correlator.correlatorId = ?").intern();
- private static final String LOCK_SELECTORS = "update " + HCorrelatorSelector.class.getName() +
- " set lock = lock+1 where correlationKey = :ckey and correlator= :corr".intern();
+ private static final String LOCK_SELECTORS = "update from " + HCorrelatorSelector.class.getName() +
+ " set lock = lock+1 where correlationKey = ? and processType = ?".intern();
/** Query for removing routes. */
private static final String QRY_DELSELECTORS = "delete from " + HCorrelatorSelector.class.getName()
@@ -86,9 +87,7 @@
// We really should consider the possibility of multiple messages matching a criteria.
// When the message is handled, its not too convenient to attempt to determine if the
// received message conflicts with one already received.
-
Iterator mcors = qry.iterate();
-
try {
if (!mcors.hasNext()) {
__log.debug(hdr + "did not find a MESSAGE entry.");
@@ -96,11 +95,8 @@
}
HCorrelatorMessage mcor = (HCorrelatorMessage) mcors.next();
-
-
__log.debug(hdr + "found MESSAGE entry " + mcor.getMessageExchange());
removeEntries(mcor.getMessageExchange());
-
return new MessageExchangeDaoImpl(_sm, mcor.getMessageExchange());
} finally {
Hibernate.close(mcors);
@@ -116,25 +112,27 @@
// will not necessarily work, as different DB vendors attach a different meaning to this syntax.
// In particular it is not clear how long the lock should be held, for the lifetime of the
// resulting cursor, or for the lifetime of the transaction. So really, an UPDATE of the row
- // is a much safer alternative.
+ // is a much safer alternative.
+ String processType = new QName(_hobj.getProcess().getTypeNamespace(), _hobj.getProcess().getTypeName()).toString();
Query lockQry = getSession().createQuery(LOCK_SELECTORS);
- lockQry.setString("ckey", key == null ? null : key.toCanonicalString());
- lockQry.setEntity("corr",_hobj);
+ lockQry.setString(0, key == null ? null : key.toCanonicalString());
+ lockQry.setString(1, processType);
if (lockQry.executeUpdate() > 0) {
- Query q = getSession().createFilter(_hobj.getSelectors(), FLTR_SELECTORS);
+ Query q = getSession().createQuery(FLTR_SELECTORS);
q.setString(0, key == null ? null : key.toCanonicalString());
- q.setLockMode("this", LockMode.UPGRADE);
+ q.setString(1, processType);
+ q.setString(2, _hobj.getCorrelatorId());
+ q.setLockMode("hs", LockMode.UPGRADE);
HCorrelatorSelector selector;
try {
selector = (HCorrelatorSelector) q.uniqueResult();
} catch (Exception ex) {
__log.debug("Strange, could not get a unique result for findRoute, trying to iterate instead.");
-
+
Iterator i = q.iterate();
- if (i.hasNext())
- selector = (HCorrelatorSelector) i.next();
+ if (i.hasNext()) selector = (HCorrelatorSelector) i.next();
else selector = null;
Hibernate.close(i);
}
@@ -187,6 +185,7 @@
hsel.setLock(0);
hsel.setCorrelationKey(correlationKey.toCanonicalString());
hsel.setInstance((HProcessInstance) ((ProcessInstanceDaoImpl) target).getHibernateObj());
+ hsel.setProcessType(target.getProcess().getType().toString());
hsel.setCorrelator(_hobj);
hsel.setCreated(new Date());
// _hobj.addSelector(hsel);
Modified: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java (original)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java Mon May 19 15:57:24 2008
@@ -26,14 +26,11 @@
public class HCorrelatorSelector extends HObject {
private HProcessInstance _instance;
-
private String _groupId;
-
private int _idx;
-
private HCorrelator _correlator;
-
private String _correlationKey;
+ private String _processType;
/**
* @hibernate.many-to-one column="PIID" not-null="true"
@@ -93,6 +90,17 @@
}
/**
+ * @hibernate.property column="PROC_TYPE" not-null="true"
+ */
+ public String getProcessType() {
+ return _processType;
+ }
+
+ public void setProcessType(String _processType) {
+ this._processType = _processType;
+ }
+
+ /**
* @hibernate.many-to-one not-null="true"
* @hibernate.column name="CORRELATOR" not-null="true"
* index="IDX_SELECTOR_CORRELATOR" unique-key="UNIQ_SELECTOR"
@@ -104,5 +112,5 @@
public void setCorrelator(HCorrelator correlator) {
_correlator = correlator;
}
-
+
}
Modified: ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java (original)
+++ ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java Mon May 19 15:57:24 2008
@@ -25,23 +25,19 @@
import org.apache.ode.bpel.dao.MessageRouteDAO;
import org.apache.ode.bpel.dao.ProcessInstanceDAO;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
+import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
@Entity
@Table(name="ODE_CORRELATOR")
+@NamedQueries({
+ @NamedQuery(name="RouteByCKey", query="SELECT route " +
+ "FROM MessageRouteDAOImpl as route " +
+ "WHERE route._correlationKey = :ckey and route._correlator._process._processType = :ptype")
+ })
public class CorrelatorDAOImpl extends OpenJPADAO implements CorrelatorDAO {
@Id @Column(name="CORRELATOR_ID")
@@ -69,8 +65,8 @@
}
public MessageExchangeDAO dequeueMessage(CorrelationKey correlationKey) {
- for (Iterator itr=_exchanges.iterator(); itr.hasNext();){
- MessageExchangeDAOImpl mex = (MessageExchangeDAOImpl)itr.next();
+ for (Iterator<MessageExchangeDAOImpl> itr=_exchanges.iterator(); itr.hasNext();){
+ MessageExchangeDAOImpl mex = itr.next();
if (mex.getCorrelationKeys().contains(correlationKey)) {
itr.remove();
return mex;
@@ -91,10 +87,12 @@
}
public MessageRouteDAO findRoute(CorrelationKey correlationKey) {
- for (MessageRouteDAOImpl mr : _routes ) {
- if ( mr.getCorrelationKey().equals(correlationKey)) return mr;
- }
- return null;
+ Query qry = getEM().createNamedQuery("RouteByCKey");
+ qry.setParameter("ckey", correlationKey.toCanonicalString());
+ qry.setParameter("ptype", _process.getType().toString());
+ List<MessageRouteDAO> routes = (List<MessageRouteDAO>) qry.getResultList();
+ if (routes.size() > 0) return routes.get(0);
+ else return null;
}
public String getCorrelatorId() {
@@ -107,8 +105,8 @@
}
void removeLocalRoutes(String routeGroupId, ProcessInstanceDAO target) {
- for (Iterator itr=_routes.iterator(); itr.hasNext(); ) {
- MessageRouteDAOImpl mr = (MessageRouteDAOImpl)itr.next();
+ for (Iterator<MessageRouteDAOImpl> itr=_routes.iterator(); itr.hasNext(); ) {
+ MessageRouteDAOImpl mr = itr.next();
if ( mr.getGroupId().equals(routeGroupId) && mr.getTargetInstance().equals(target)) {
itr.remove();
getEM().remove(mr);
Modified: ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java (original)
+++ ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java Mon May 19 15:57:24 2008
@@ -88,7 +88,7 @@
}
public Element getHeader() {
- if ( _headerElement == null && _header != null ) {
+ if ( _headerElement == null && _header != null && !"".equals(_header)) {
try {
_headerElement = DOMUtils.stringToDOM(_header);
} catch (Exception e) {
Modified: ode/trunk/il-common/src/main/java/org/apache/ode/il/epr/WSDL11Endpoint.java
URL: http://svn.apache.org/viewvc/ode/trunk/il-common/src/main/java/org/apache/ode/il/epr/WSDL11Endpoint.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/il-common/src/main/java/org/apache/ode/il/epr/WSDL11Endpoint.java (original)
+++ ode/trunk/il-common/src/main/java/org/apache/ode/il/epr/WSDL11Endpoint.java Mon May 19 15:57:24 2008
@@ -39,14 +39,20 @@
public WSDL11Endpoint() {
}
- public String getUrl() {
- Element port = (Element) _serviceElmt.getElementsByTagNameNS(Namespaces.WSDL_11, "port").item(0);
- Element address = (Element) port.getElementsByTagNameNS(Namespaces.SOAP_NS, "address").item(0);
- if (address == null)
- throw new IllegalArgumentException("The soap:address element in element "
- + DOMUtils.domToString(_serviceElmt) + " is missing or in the wrong namespace.");
- return address.getAttribute("location");
- }
+ public String getUrl() {
+ Element port = (Element) _serviceElmt.getElementsByTagNameNS(Namespaces.WSDL_11, "port").item(0);
+ // get soap:address
+ Element address = (Element) port.getElementsByTagNameNS(Namespaces.SOAP_NS, "address").item(0);
+ // ... or the http:address
+ if (address == null) {
+ address = (Element) port.getElementsByTagNameNS(Namespaces.HTTP_NS, "address").item(0);
+ }
+ if (address == null) {
+ throw new IllegalArgumentException("soap:address and http:address element in element "
+ + DOMUtils.domToString(_serviceElmt) + " is missing or in the wrong namespace.");
+ }
+ return address.getAttribute("location");
+ }
public QName getServiceName() {
return new QName(_serviceElmt.getAttribute("targetNamespace"), _serviceElmt.getAttribute("name"));
Modified: ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
URL: http://svn.apache.org/viewvc/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java (original)
+++ ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java Mon May 19 15:57:24 2008
@@ -223,7 +223,8 @@
sched.setTransactionManager((TransactionManager) _ode.getContext().getTransactionManager());
_ode._scheduler = sched;
- _ode._store = new ProcessStoreImpl(_ode._dataSource, _ode._config.getDAOConnectionFactory(), false);
+ _ode._store = new ProcessStoreImpl(_ode._dataSource,
+ _ode._config.getDAOConnectionFactory(), _ode._config, false);
_ode._store.loadAll();
_ode._server.setDaoConnectionFactory(_ode._daocf);
Modified: ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java?rev=658024&r1=658023&r2=658024&view=diff
==============================================================================
--- ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java (original)
+++ ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java Mon May 19 15:57:24 2008
@@ -19,12 +19,7 @@
package org.apache.ode.scheduler.simple;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
+import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -42,10 +37,10 @@
/**
* A reliable and relatively simple scheduler that uses a database to persist information about scheduled tasks.
- *
+ *
* The challange is to achieve high performance in a small memory footprint without loss of reliability while supporting
* distributed/clustered configurations.
- *
+ *
* The design is based around three time horizons: "immediate", "near future", and "everything else". Immediate jobs (i.e. jobs that
* are about to be up) are written to the database and kept in an in-memory priority queue. When they execute, they are removed from
* the database. Near future jobs are placed in the database and assigned to the current node, however they are not stored in
@@ -53,9 +48,9 @@
* that are further out in time, are placed in the database without a node identifer; when they are ready to be "upgraded" to
* near-future jobs they are assigned to one of the known live nodes. Recovery is rather straighforward, with stale node identifiers
* being reassigned to known good nodes.
- *
+ *
* @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
- *
+ *
*/
public class SimpleScheduler implements Scheduler, TaskRunner {
private static final Log __log = LogFactory.getLog(SimpleScheduler.class);
@@ -64,7 +59,7 @@
* Jobs scheduled with a time that is between [now, now+immediateInterval] will be assigned to the current node, and placed
* directly on the todo queue.
*/
- long _immediateInterval = 60000;
+ long _immediateInterval = 30000;
/**
* Jobs sccheduled with a time that is between (now+immediateInterval,now+nearFutureInterval) will be assigned to the current
@@ -283,14 +278,14 @@
__log.error(errmsg, de);
throw new ContextException(errmsg, de);
}
-
+
if (!deleted) {
try {
_txm.getTransaction().setRollbackOnly();
} catch (Exception ex) {
__log.error("Transaction manager error; setRollbackOnly() failed.", ex);
}
-
+
throw new ContextException("Job no longer in database: jobId=" + jobId);
}
}
@@ -298,16 +293,23 @@
/**
* Run a job in the current thread.
- *
+ *
* @param job
* job to run.
*/
protected void runJob(final Job job) {
- final Scheduler.JobInfo jobInfo = new Scheduler.JobInfo(job.jobId, job.detail, 0);
- // TODO implement retries
+ final Scheduler.JobInfo jobInfo = new Scheduler.JobInfo(job.jobId, job.detail,
+ (Integer)(job.detail.get("retry") != null ? job.detail.get("retry") : 0));
try {
- _jobProcessor.onScheduledJob(jobInfo);
+ try {
+ _jobProcessor.onScheduledJob(jobInfo);
+ } catch (JobProcessorException jpe) {
+ if (jpe.retry) {
+ __log.error("Error while processing transaction, retrying.", jpe);
+ doRetry(job);
+ } else __log.error("Error while processing transaction, no retry.", jpe);
+ }
} catch (Exception ex) {
__log.error("Error in scheduler processor.", ex);
}
@@ -431,7 +433,7 @@
/**
* Re-assign stale node's jobs to self.
- *
+ *
* @param nodeId
*/
void recoverStaleNode(final String nodeId) {
@@ -463,6 +465,14 @@
}
+ private void doRetry(Job job) throws DatabaseException {
+ Calendar retryTime = Calendar.getInstance();
+ retryTime.add(Calendar.SECOND, 2);
+ job.detail.put("retry", job.detail.get("retry") != null ? (((Integer)job.detail.get("retry")) + 1) : 1);
+ Job jobRetry = new Job(retryTime.getTime().getTime(), true, job.detail);
+ _db.insertJob(jobRetry, _nodeId, false);
+ }
+
private abstract class SchedulerTask extends Task implements Runnable {
SchedulerTask(long schedDate) {
super(schedDate);
@@ -491,9 +501,9 @@
/**
* Upgrade jobs from far future to immediate future (basically, assign them to a node).
- *
+ *
* @author mszefler
- *
+ *
*/
private class UpgradeJobsTask extends SchedulerTask {
@@ -518,7 +528,7 @@
try {
success = doUpgrade();
} finally {
- long future = System.currentTimeMillis() + (success ? (long) (_nearFutureInterval * .75) : 100);
+ long future = System.currentTimeMillis() + (success ? (long) (_nearFutureInterval * .50) : 100);
_nextUpgrade.set(future);
_todo.enqueue(new UpgradeJobsTask(future));
__log.debug("UPGRADE completed, success = " + success + "; next time in " + (future - ctime) + "ms");