Author: rr
Date: Thu Jul 22 07:22:14 2010
New Revision: 966524
URL: http://svn.apache.org/viewvc?rev=966524&view=rev
Log:
Undefined XSD element (test + fix)
Added:
ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.bpel
ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.wsdl
Modified:
ode/trunk/Rakefile
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java
ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java
ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java
ode/trunk/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java
Modified: ode/trunk/Rakefile
URL:
http://svn.apache.org/viewvc/ode/trunk/Rakefile?rev=966524&r1=966523&r2=966524&view=diff
==============================================================================
--- ode/trunk/Rakefile (original)
+++ ode/trunk/Rakefile Thu Jul 22 07:22:14 2010
@@ -155,6 +155,7 @@ define "ode" do
compile.with projects("bpel-api", "bpel-obj", "bpel-schemas", "utils"),
COMMONS.logging, JAVAX.stream, JAXEN, SAXON, WSDL4J, XALAN, XERCES,
COMMONS.collections
test.resources {
filter(project("bpel-scripts").path_to("src/main/resources")).into(test.resources.target).run
}
+ test.with LOG4J
package :jar
test.with SLF4J, LOG4J
end
Modified:
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java?rev=966524&r1=966523&r2=966524&view=diff
==============================================================================
---
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
(original)
+++
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
Thu Jul 22 07:22:14 2010
@@ -228,7 +228,7 @@ public abstract class BpelCompiler imple
xsdStream.close();
}
- Map<URI, byte[]> schemas = XSUtils.captureSchema(resFrom, data,
resolver);
+ Map<URI, byte[]> schemas = XSUtils.captureSchema(resFrom, data,
resolver, 0);
_wsdlRegistry.addSchemas(schemas);
} catch (XsdException e) {
CompilationException ce = new
CompilationException(__cmsgs.errInvalidImport(location.toString()));
Modified:
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java?rev=966524&r1=966523&r2=966524&view=diff
==============================================================================
---
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
(original)
+++
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
Thu Jul 22 07:22:14 2010
@@ -209,6 +209,7 @@ class WSDLRegistry {
Types types = def.getTypes();
if (types != null) {
+ int localSchemaId = 0;
for (Iterator<ExtensibilityElement> iter =
((List<ExtensibilityElement>)def.getTypes().getExtensibilityElements()).iterator();
iter.hasNext();) {
@@ -218,8 +219,13 @@ class WSDLRegistry {
byte[] schema = ((XMLSchemaType)ee).getXMLSchema();
WsdlFinderXMLEntityResolver resolver = new
WsdlFinderXMLEntityResolver(rf, defuri, _internalSchemas, false);
try {
- Map<URI, byte[]> capture =
XSUtils.captureSchema(defuri, schema, resolver);
- _schemas.putAll(capture);
+ Map<URI, byte[]> capture =
XSUtils.captureSchema(defuri, schema, resolver, localSchemaId);
+ for (URI uri : capture.keySet()) {
+ if (!_schemas.containsKey(uri)) {
+ _schemas.put(uri, capture.get(uri));
+ }
+ }
+// _schemas.putAll(capture);
try {
Document doc = DOMUtils.parse(new InputSource(new
ByteArrayInputStream(schema)));
@@ -259,6 +265,7 @@ class WSDLRegistry {
// invalidate model
_model = null;
+ localSchemaId ++;
}
}
}
Modified:
ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java?rev=966524&r1=966523&r2=966524&view=diff
==============================================================================
---
ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java
(original)
+++
ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java
Thu Jul 22 07:22:14 2010
@@ -279,4 +279,8 @@ public class GoodCompileTest extends Abs
runTest("/2.0/good/circularReference/CircularReference.bpel");
}
+ @Test
+ public void testMultipleEmbeddedSchemas() throws Exception {
+ runTest("/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.bpel");
+ }
}
Added:
ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.bpel
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.bpel?rev=966524&view=auto
==============================================================================
---
ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.bpel
(added)
+++
ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.bpel
Thu Jul 22 07:22:14 2010
@@ -0,0 +1,33 @@
+<!--
+ ~ 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.
+ -->
+
+<process
+ name="InvalidBpelFunction" suppressJoinFailure="yes"
+ targetNamespace="http://ode/test/compile"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/test/compile"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/test/compile.wsdl">
+ <import namespace="http://ode/test/compile.wsdl"
location="MultipleEmbeddedSchemas.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/"/>
+ <variables>
+ <variable name="var1" messageType="test:TestMessage" />
+ </variables>
+ <empty/>
+</process>
Added:
ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.wsdl
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.wsdl?rev=966524&view=auto
==============================================================================
---
ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.wsdl
(added)
+++
ode/trunk/bpel-compiler/src/test/resources/org/apache/ode/bpel/compiler/MultipleEmbeddedSchemas.wsdl
Thu Jul 22 07:22:14 2010
@@ -0,0 +1,49 @@
+<?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/"
xmlns:tns="http://ode/test/compile.wsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns:t1="http://mytest1" xmlns:t2="http://mytest2"
targetNamespace="http://ode/test/compile.wsdl">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://mytest1">
+ <xsd:complexType name="MyBean1">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="bubble" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://mytest2">
+ <xsd:complexType name="MyBean2">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="bubble" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="TestMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ <wsdl:part name="TestPart2" type="t1:MyBean1"/>
+ <wsdl:part name="TestPart3" type="t2:MyBean2"/>
+ </wsdl:message>
+ <wsdl:portType name="TestPortType">
+ <wsdl:operation name="testOperation">
+ <wsdl:input message="tns:TestMessage" name="TestIn"/>
+ <wsdl:output message="tns:TestMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <bpws:property name="testProp" type="xsd:string"/>
+</wsdl:definitions>
Modified:
ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java
URL:
http://svn.apache.org/viewvc/ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java?rev=966524&r1=966523&r2=966524&view=diff
==============================================================================
--- ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java
(original)
+++ ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java
Thu Jul 22 07:22:14 2010
@@ -193,6 +193,8 @@ public class SchemaModelImpl implements
location = resourceIdentifier.getLiteralSystemId();
else if (resourceIdentifier.getExpandedSystemId() != null &&
_schemas.get(resourceIdentifier.getExpandedSystemId()) != null)
location = resourceIdentifier.getExpandedSystemId();
+ else if (resourceIdentifier.getBaseSystemId() != null &&
_schemas.get(resourceIdentifier.getBaseSystemId()) != null)
+ location = resourceIdentifier.getBaseSystemId();
else {
if (__log.isDebugEnabled()) {
__log.debug("Available schemas " + _schemas.keySet());
Modified: ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java
URL:
http://svn.apache.org/viewvc/ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java?rev=966524&r1=966523&r2=966524&view=diff
==============================================================================
--- ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java
(original)
+++ ode/trunk/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java Thu Jul
22 07:22:14 2010
@@ -58,7 +58,7 @@ public class XSUtils {
* @return
*/
public static Map<URI, byte[]> captureSchema(URI systemURI, byte[]
schemaData,
- XMLEntityResolver resolver)
throws XsdException {
+ XMLEntityResolver resolver,
int localSchemaId) throws XsdException {
if (__log.isDebugEnabled())
__log.debug("captureSchema(URI,Text,...): systemURI=" + systemURI);
@@ -67,7 +67,9 @@ public class XSUtils {
input.setStringData(new String(schemaData));
Map<URI, byte[]> ret = captureSchema(input, resolver);
- ret.put(systemURI, schemaData);
+
+ URI localURI = localSchemaId == 0 ? systemURI :
URI.create(systemURI.toString() + '.' + localSchemaId);
+ ret.put(localURI, schemaData);
return ret;
}
Modified:
ode/trunk/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java
URL:
http://svn.apache.org/viewvc/ode/trunk/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java?rev=966524&r1=966523&r2=966524&view=diff
==============================================================================
---
ode/trunk/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java
(original)
+++
ode/trunk/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java
Thu Jul 22 07:22:14 2010
@@ -62,7 +62,7 @@ public class SchemaCaptureTest extends T
return src;
}
- });
+ }, 0);
// we expect the root schema and three includes
__log.debug("loaded " + s.keySet());
assertEquals(5, s.size());