Author: indika
Date: Tue Dec 18 22:28:34 2007
New Revision: 605446
URL: http://svn.apache.org/viewvc?rev=605446&view=rev
Log:
Committing Andreas Veithen's patch for the URI Resorce resolver for WSDL import
resolving ...
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMap.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapURIResolver.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapWSDLLocator.java
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java?rev=605446&r1=605445&r2=605446&view=diff
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
(original)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
Tue Dec 18 22:28:34 2007
@@ -52,6 +52,7 @@
* <publishWSDL uri=".." key="string">
* <wsdl:definition>...</wsdl:definition>?
* <wsdl20:description>...</wsdl20:description>?
+ * <resource location="..." key="..."/>*
* </publishWSDL>?
* <enableSec/>?
* <enableRM/>?
@@ -238,6 +239,7 @@
}
}
}
+ proxy.setResourceMap(ResourceMapFactory.createResourceMap(wsdl));
}
// OMElement schema = elem.getFirstChildWithName(
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java?rev=605446&r1=605445&r2=605446&view=diff
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java
(original)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java
Tue Dec 18 22:28:34 2007
@@ -50,6 +50,7 @@
* <publishWSDL uri=".." key="string">
* <wsdl:definition>...</wsdl:definition>?
* <wsdl20:description>...</wsdl20:description>?
+ * <resource location="..." key="..."/>*
* </publishWSDL>?
* <policy key="string">
* // optional service parameters
@@ -167,17 +168,18 @@
String wsdlKey = service.getWSDLKey();
URI wsdlUri = service.getWsdlURI();
Object inLineWSDL = service.getInLineWSDL();
- OMElement wsdl = fac.createOMElement("publishWSDL", synNS);
- if (wsdlKey != null) {
- wsdl.addAttribute(fac.createOMAttribute(
- "key", nullNS, wsdlKey));
- proxy.addChild(wsdl);
- } else if (inLineWSDL != null) {
- wsdl.addChild((OMNode) inLineWSDL);
- proxy.addChild(wsdl);
- } else if (wsdlUri != null) {
- wsdl.addAttribute(fac.createOMAttribute(
- "uri", nullNS, wsdlUri.toString()));
+ if (wsdlKey != null || wsdlUri != null || inLineWSDL != null) {
+ OMElement wsdl = fac.createOMElement("publishWSDL", synNS);
+ if (wsdlKey != null) {
+ wsdl.addAttribute(fac.createOMAttribute(
+ "key", nullNS, wsdlKey));
+ } else if (inLineWSDL != null) {
+ wsdl.addChild((OMNode) inLineWSDL);
+ } else if (wsdlUri != null) {
+ wsdl.addAttribute(fac.createOMAttribute(
+ "uri", nullNS, wsdlUri.toString()));
+ }
+ ResourceMapSerializer.serializeResourceMap(wsdl,
service.getResourceMap());
proxy.addChild(wsdl);
}
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapFactory.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapFactory.java?rev=605446&view=auto
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapFactory.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapFactory.java
Tue Dec 18 22:28:34 2007
@@ -0,0 +1,72 @@
+/*
+ * 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.synapse.config.xml;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.core.axis2.ResourceMap;
+
+/**
+ * Creates a ResourceMap object based on a set of <tt><resource></tt>
elements:
+ * <pre>
+ * <resource location="..." key="..."/>*
+ * </pre>
+ */
+public class ResourceMapFactory {
+ private static final Log log = LogFactory.getLog(ResourceMapFactory.class);
+
+ public static ResourceMap createResourceMap(OMElement elem) {
+ ResourceMap resourceMap = null;
+ Iterator it = elem.getChildrenWithName(
+ new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "resource"));
+ while (it.hasNext()) {
+ // Lazily create the ResourceMap, so that when no <resource>
+ // elements are found, the method returns null.
+ if (resourceMap == null) {
+ resourceMap = new ResourceMap();
+ }
+ OMElement resourceElem = (OMElement)it.next();
+ OMAttribute location = resourceElem.getAttribute
+ (new QName(XMLConfigConstants.NULL_NAMESPACE, "location"));
+ if (location == null) {
+ handleException("The 'location' attribute is required for a
resource definition");
+ }
+ OMAttribute key = resourceElem.getAttribute(
+ new QName(XMLConfigConstants.NULL_NAMESPACE, "key"));
+ if (key == null) {
+ handleException("The 'key' attribute is required for a
resource definition");
+ }
+ resourceMap.addResource(location.getAttributeValue(),
key.getAttributeValue());
+ }
+ return resourceMap;
+ }
+
+ private static void handleException(String msg) {
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+}
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapSerializer.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapSerializer.java?rev=605446&view=auto
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapSerializer.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ResourceMapSerializer.java
Tue Dec 18 22:28:34 2007
@@ -0,0 +1,53 @@
+/*
+ * 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.synapse.config.xml;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.synapse.SynapseConstants;
+import org.apache.synapse.core.axis2.ResourceMap;
+
+/**
+ * Creates a sequence of <tt><resource></tt> elements from a ResourceMap
object:
+ * <pre>
+ * <resource location="..." key="..."/>*
+ * </pre>
+ */
+public class ResourceMapSerializer {
+ private static final OMFactory fac = OMAbstractFactory.getOMFactory();
+
+ public static void serializeResourceMap(OMElement parent, ResourceMap
resourceMap) {
+ if (resourceMap != null) {
+ Iterator it = resourceMap.getResources().entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry)it.next();
+ OMElement resource = fac.createOMElement("resource",
+ SynapseConstants.SYNAPSE_OMNAMESPACE);
+ resource.addAttribute("location", (String)entry.getKey(),
null);
+ resource.addAttribute("key", (String)entry.getValue(), null);
+ parent.addChild(resource);
+ }
+ }
+ }
+}
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java?rev=605446&r1=605445&r2=605446&view=diff
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
(original)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
Tue Dec 18 22:28:34 2007
@@ -34,6 +34,7 @@
import org.apache.synapse.endpoints.Endpoint;
import org.apache.synapse.config.SynapseConfiguration;
import org.apache.synapse.config.SynapseConfigUtils;
+import org.xml.sax.InputSource;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
@@ -56,6 +57,7 @@
* <publishWSDL uri=".." key="string">
* <wsdl:definition>...</wsdl:definition>?
* <wsdl20:description>...</wsdl20:description>?
+ * <resource location="..." key="..."/>*
* </publishWSDL>?
* <enableSec/>?
* <enableRM/>?
@@ -136,6 +138,11 @@
*/
private Object inLineWSDL;
/**
+ * A ResourceMap object allowing to locate artifacts (WSDL and XSD)
imported
+ * by the service WSDL to be located in the registry.
+ */
+ private ResourceMap resourceMap;
+ /**
* The keys for any supplied policies that would apply at the service level
*/
private List serviceLevelPolicies = new ArrayList();
@@ -265,6 +272,24 @@
wsdlToAxisServiceBuilder.setBaseUri(
wsdlURI != null ? wsdlURI.toString() : "");
+
+ if (resourceMap != null) {
+
+ if (trace()) {
+ trace.info("Setting up custom resolvers");
+ }
+ // Set up the URIResolver
+ wsdlToAxisServiceBuilder.setCustomResolver(
+ new ResourceMapURIResolver(resourceMap,
synCfg));
+ // Axis 2 also needs a WSDLLocator for WSDL 1.1
documents
+ if (wsdlToAxisServiceBuilder instanceof
WSDL11ToAxisServiceBuilder) {
+ ((WSDL11ToAxisServiceBuilder)
+
wsdlToAxisServiceBuilder).setCustomWSLD4JResolver(
+ new ResourceMapWSDLLocator(new
InputSource(wsdlInputStream),
+ wsdlURI != null ?
wsdlURI.toString() : "",
+ resourceMap,
synCfg));
+ }
+ }
if (trace()) {
trace.info("Populating Axis2 service using WSDL");
@@ -733,6 +758,14 @@
public void setPinnedServers(List pinnedServers) {
this.pinnedServers = pinnedServers;
+ }
+
+ public ResourceMap getResourceMap() {
+ return resourceMap;
+ }
+
+ public void setResourceMap(ResourceMap resourceMap) {
+ this.resourceMap = resourceMap;
}
}
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMap.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMap.java?rev=605446&view=auto
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMap.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMap.java
Tue Dec 18 22:28:34 2007
@@ -0,0 +1,111 @@
+/*
+ * 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.synapse.core.axis2;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.xml.sax.InputSource;
+
+/**
+ * A resource map.
+ *
+ * Instances of this class are used to resolve resources using registry
entries.
+ * This is useful for XML documents that can reference other documents (e.g.
WSDL documents
+ * importing XSD or other WSDL documents). A <code>ResourceMap</code> object
contains a set of
+ * (location, registry key) mappings. The <code>resolve</code> method can be
used to
+ * get retrieve the registry entry registered for a given location as an
<code>InputSource</code>
+ * object.
+ */
+public class ResourceMap {
+ private static final Log log =
LogFactory.getLog(ResourceMapURIResolver.class);
+
+ private final Map/*<String,String>*/ resources = new LinkedHashMap();
+
+ /**
+ * Add a resource.
+ *
+ * @param location the location as it appears in referencing documents
+ * @param key the registry key that points to the referenced document
+ */
+ public void addResource(String location, String key) {
+ resources.put(location, key);
+ }
+
+ /**
+ * Get the (location, registry key) mappings.
+ *
+ * @return a map containing the (location, registry key) pairs
+ */
+ public Map getResources() {
+ return Collections.unmodifiableMap(resources);
+ }
+
+ /**
+ * Resolve a resource for a given location.
+ *
+ * @param synCfg the Synapse configuration (used to access the registry)
+ * @param location the location of of the resource at is appears in the
referencing document
+ * @return an <code>InputSource</code> object for the referenced resource
+ */
+ public InputSource resolve(SynapseConfiguration synCfg, String location) {
+ String key = (String)resources.get(location);
+ if (key == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("No resource mapping is defined for location '" +
location + "'");
+ }
+ return null;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Resolving location '" + location + "' to registry
item '" + key + "'");
+ }
+ synCfg.getEntryDefinition(key);
+ Object keyObject = synCfg.getEntry(key);
+ if (keyObject instanceof OMElement) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try {
+ ((OMElement)keyObject).serialize(baos);
+ }
+ catch (XMLStreamException ex) {
+ String msg = "Unable to serialize registry item '" + key +
"' for location '" +
+ location + "' is not an OMElement";
+ log.error(msg);
+ throw new SynapseException(msg, ex);
+ }
+ return new InputSource(new
ByteArrayInputStream(baos.toByteArray()));
+ } else {
+ String msg = "Registry item '" + key + "' for location '" +
+ location + "' is not an OMElement";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ }
+ }
+}
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapURIResolver.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapURIResolver.java?rev=605446&view=auto
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapURIResolver.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapURIResolver.java
Tue Dec 18 22:28:34 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.synapse.core.axis2;
+
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.ws.commons.schema.resolver.URIResolver;
+import org.xml.sax.InputSource;
+
+/**
+ * Class that adapts a ResourceMap to URIResolver.
+ */
+public class ResourceMapURIResolver implements URIResolver {
+ private final ResourceMap resourceMap;
+ private final SynapseConfiguration synCfg;
+
+ public ResourceMapURIResolver(ResourceMap resourceMap,
+ SynapseConfiguration synCfg) {
+ this.resourceMap = resourceMap;
+ this.synCfg = synCfg;
+ }
+
+ public InputSource resolveEntity(String targetNamespace, String
schemaLocation, String baseUri) {
+ return resourceMap.resolve(synCfg, schemaLocation);
+ }
+}
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapWSDLLocator.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapWSDLLocator.java?rev=605446&view=auto
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapWSDLLocator.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ResourceMapWSDLLocator.java
Tue Dec 18 22:28:34 2007
@@ -0,0 +1,68 @@
+/*
+ * 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.synapse.core.axis2;
+
+import javax.wsdl.xml.WSDLLocator;
+
+import org.apache.synapse.config.SynapseConfiguration;
+import org.xml.sax.InputSource;
+
+/**
+ * Class that adapts a ResourceMap object to WSDLLocator.
+ */
+public class ResourceMapWSDLLocator implements WSDLLocator {
+ private final InputSource baseInputSource;
+ private final String baseURI;
+ private final ResourceMap resourceMap;
+ private final SynapseConfiguration synCfg;
+
+ private String latestImportURI;
+
+ public ResourceMapWSDLLocator(InputSource baseInputSource,
+ String baseURI,
+ ResourceMap resourceMap,
+ SynapseConfiguration synCfg) {
+ this.baseInputSource = baseInputSource;
+ this.baseURI = baseURI;
+ this.resourceMap = resourceMap;
+ this.synCfg = synCfg;
+ }
+
+ public InputSource getBaseInputSource() {
+ return baseInputSource;
+ }
+
+ public String getBaseURI() {
+ return baseURI;
+ }
+
+ public InputSource getImportInputSource(String parentLocation, String
relativeLocation) {
+ InputSource result = resourceMap.resolve(synCfg, relativeLocation);
+ latestImportURI = relativeLocation;
+ return result;
+ }
+
+ public String getLatestImportURI() {
+ return latestImportURI;
+ }
+
+ public void close() {
+ }
+}
Modified:
webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java?rev=605446&r1=605445&r2=605446&view=diff
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java
(original)
+++
webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java
Tue Dec 18 22:28:34 2007
@@ -30,7 +30,11 @@
public void testProxyServiceSerializationSenarioOne() throws Exception {
- String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"
name=\"name\" startOnLoad=\"true\"
transports=\"http\"><description>description</description><target
inSequence=\"inseqname\" outSequence=\"outseqname\"
faultSequence=\"faultseqname\" /><publishWSDL uri=\"http://uri\"
></publishWSDL><policy key=\"key\"/><parameter
name=\"para\">text</parameter></proxy>";
+ String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"
name=\"name\" " +
+ "startOnLoad=\"true\"
transports=\"http\"><description>description</description>" +
+ "<target inSequence=\"inseqname\" outSequence=\"outseqname\"
faultSequence=\"faultseqname\" />" +
+ "<publishWSDL uri=\"http://uri\" ></publishWSDL><policy
key=\"key\"/>" +
+ "<parameter name=\"para\">text</parameter></proxy>";
OMElement inputOM = createOMElement(inputXml);
ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
OMElement resultOM = ProxyServiceSerializer.serializeProxy(null,
proxy);
@@ -38,7 +42,10 @@
}
public void testProxyServiceSerializationSenarioTwo() throws Exception {
- String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"
startOnLoad=\"true\" name=\"name\"
transports=\"http\"><description>description</description><target
endpoint=\"epr\" outSequence=\"out\"/><publishWSDL
key=\"key\"></publishWSDL><policy key=\"key\"/><parameter
name=\"para\">text</parameter></proxy>";
+ String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"
startOnLoad=\"true\" " +
+ "name=\"name\"
transports=\"http\"><description>description</description>" +
+ "<target endpoint=\"epr\" outSequence=\"out\"/><publishWSDL
key=\"key\">" +
+ "</publishWSDL><policy key=\"key\"/><parameter
name=\"para\">text</parameter></proxy>";
OMElement inputOM = createOMElement(inputXml);
ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
OMElement resultOM = ProxyServiceSerializer.serializeProxy(null,
proxy);
@@ -46,7 +53,11 @@
}
public void testProxyServiceSerializationSenarioThree() throws Exception {
- String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"
name=\"name\" startOnLoad=\"true\"
transports=\"http\"><description>description</description><target><inSequence
onError=\"ref\"><send/></inSequence><outSequence><send/></outSequence></target><publishWSDL
key=\"key\"></publishWSDL><policy key=\"key\"/><parameter
name=\"para\">text</parameter></proxy>";
+ String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" " +
+ "name=\"name\" startOnLoad=\"true\"
transports=\"http\"><description>" +
+ "description</description><target><inSequence
onError=\"ref\"><send/></inSequence>" +
+ "<outSequence><send/></outSequence></target><publishWSDL
key=\"key\"></publishWSDL>" +
+ "<policy key=\"key\"/><parameter
name=\"para\">text</parameter></proxy>";
OMElement inputOM = createOMElement(inputXml);
ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
OMElement resultOM = ProxyServiceSerializer.serializeProxy(null,
proxy);
@@ -60,12 +71,17 @@
// ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
// OMElement resultOM = ProxyServiceSerializer.serializeProxy(null,
proxy);
// assertTrue(comparator.compare(resultOM, inputOM));
-// }
+
+ // }
public void testProxyServiceSerializationSenarioFive() throws Exception {
- String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"
startOnLoad=\"true\" name=\"name\"
transports=\"http\"><description>description</description><target><endpoint><address
uri=\"http://www.example.com/testepr\"/></endpoint><outSequence><send/></outSequence></target><publishWSDL
uri=\"http://uri\"></publishWSDL><policy key=\"key\"/><parameter
name=\"para\">text</parameter></proxy>";
+ String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"
startOnLoad=\"true\" " +
+ "name=\"name\"
transports=\"http\"><description>description</description><target>" +
+ "<endpoint><address
uri=\"http://www.example.com/testepr\"/></endpoint><outSequence><send/>" +
+ "</outSequence></target><publishWSDL
uri=\"http://uri\"></publishWSDL><policy key=\"key\"/>" +
+ "<parameter name=\"para\">text</parameter></proxy>";
OMElement inputOM = createOMElement(inputXml);
ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
- OMElement resultOM = ProxyServiceSerializer.serializeProxy(null,
proxy);
+ OMElement resultOM = ProxyServiceSerializer.serializeProxy(null,
proxy);
assertTrue(compare(resultOM, inputOM));
}
// public void testProxyServiceSerializationSenarioSix() throws Exception {
@@ -75,4 +91,17 @@
// OMElement resultOM = ProxyServiceSerializer.serializeProxy(null,
proxy);
// assertTrue(comparator.compare(resultOM, inputOM));
// }
+
+ public void testProxyServiceSerializationWithResourceMap() throws
Exception {
+ String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"
name=\"name\" " +
+ "startOnLoad=\"true\"><target><endpoint><address
uri=\"http://www.example.com/testepr\"/>" +
+
"</endpoint><outSequence><send/></outSequence></target><publishWSDL
uri=\"http://uri\">" +
+ "<resource location=\"test1.xsd\" key=\"test-key1\"/><resource
location=\"test2.xsd\"" +
+ " key=\"test-key2\"/></publishWSDL></proxy>";
+ OMElement inputOM = createOMElement(inputXml);
+ ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
+ assertNotNull(proxy.getResourceMap());
+ OMElement resultOM = ProxyServiceSerializer.serializeProxy(null,
proxy);
+ assertTrue(compare(resultOM, inputOM));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]