You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2007/12/21 02:21:00 UTC
svn commit: r606083 - in /incubator/cxf/trunk:
rt/javascript/src/main/java/org/apache/cxf/javascript/
rt/javascript/src/main/java/org/apache/cxf/javascript/types/
rt/javascript/src/test/resources/
systests/src/test/java/org/apache/cxf/cxf1220/ systests...
Author: bimargulies
Date: Thu Dec 20 17:20:58 2007
New Revision: 606083
URL: http://svn.apache.org/viewvc?rev=606083&view=rev
Log:
Remodularize some code in the hopes of supporting xs:any. Check in a nascent
test case for CXF-1220.
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/Cxf1220Test.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/Bean.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/package-info.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/hasenum/
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/hasenum/BasicEnum.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220Impl.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/RefEnumInAttribute.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/package-info.java (with props)
incubator/cxf/trunk/systests/src/test/resources/cxf1220Beans.xml (with props)
Modified:
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties?rev=606083&r1=606082&r2=606083&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties Thu Dec 20 17:20:58 2007
@@ -20,6 +20,8 @@
#
NON_SEQUENCE_PARTICLE=JavaScript limitation: Type {0} is not defined as a sequence. {1}
NON_ELEMENT_CHILD=JavaScript limitation: Non-Element sequence member {0} of {1}. {2}
+NON_PARTICLE_CHILD=JavaScript limitation: Non-particle sequence member {0} of {1}. {2}
+GROUP_CHILD=JavaScript limitation: unsupported xs:group {0} found in {1}. {2}
ABSTRACT_ELEMENT=JavaScript limitation: Abstract element {0} of {1}. {2}
ELEMENT_HAS_NO_TYPE=Element {0} has no type in the schema. {1}
ELEMENT_TYPE_MISSING=Element {0} references type {1} which is not defined.
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java?rev=606083&r1=606082&r2=606083&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java Thu Dec 20 17:20:58 2007
@@ -28,9 +28,11 @@
import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaAny;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaForm;
+import org.apache.ws.commons.schema.XmlSchemaObject;
import org.apache.ws.commons.schema.XmlSchemaParticle;
import org.apache.ws.commons.schema.XmlSchemaSequence;
import org.apache.ws.commons.schema.XmlSchemaType;
@@ -225,6 +227,27 @@
} else {
return isElementNameQualified(element, elementSchema);
}
+ }
+
+ /**
+ * If the object is an element or an any, return the particle. If it's not a particle, or it's a group,
+ * throw. We're not ready for groups yet.
+ * @param object
+ * @return
+ */
+ public static XmlSchemaParticle getObjectParticle(XmlSchemaObject object, XmlSchemaType type) {
+
+ if (!(object instanceof XmlSchemaParticle)) {
+ XmlSchemaUtils.unsupportedConstruct("NON_PARTICLE_CHILD",
+ object.getClass().getSimpleName(), type);
+ }
+ if (!(object instanceof XmlSchemaElement)
+ && !(object instanceof XmlSchemaAny)) {
+ XmlSchemaUtils.unsupportedConstruct("GROUP_CHILD",
+ object.getClass().getSimpleName(), type);
+ }
+
+ return (XmlSchemaParticle) object;
}
public static boolean isParticleArray(XmlSchemaParticle particle) {
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties?rev=606083&r1=606082&r2=606083&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/Messages.properties Thu Dec 20 17:20:58 2007
@@ -20,4 +20,10 @@
#
ELEMENT_MISSING_TYPE= Root element {0} refers to undefined type {1} in {2}.
UNSUPPORTED_TYPE_CONSTRUCT= Unsupported schema construct {0}.
-ELEMENT_DANGLING_REFERENCE= Element {0} refers to undefined element {1}.
\ No newline at end of file
+ELEMENT_DANGLING_REFERENCE= Element {0} refers to undefined element {1}.
+NON_SEQUENCE_PARTICLE=JavaScript limitation: Type {0} is not defined as a sequence. {1}
+NON_ELEMENT_CHILD=JavaScript limitation: Non-Element sequence member {0} of {1}. {2}
+ABSTRACT_ELEMENT=JavaScript limitation: Abstract element {0} of {1}. {2}
+ELEMENT_HAS_NO_TYPE=Element {0} has no type in the schema. {1}
+ELEMENT_TYPE_MISSING=Element {0} references type {1} which is not defined.
+ELEMENT_SCHEMA_MISSING=Element {0} contained in missing schema.
\ No newline at end of file
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=606083&r1=606082&r2=606083&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java Thu Dec 20 17:20:58 2007
@@ -36,10 +36,12 @@
import org.apache.cxf.javascript.XmlSchemaUtils;
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaAny;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaObject;
import org.apache.ws.commons.schema.XmlSchemaObjectTable;
+import org.apache.ws.commons.schema.XmlSchemaParticle;
import org.apache.ws.commons.schema.XmlSchemaSequence;
import org.apache.ws.commons.schema.XmlSchemaSimpleType;
import org.apache.ws.commons.schema.XmlSchemaType;
@@ -57,6 +59,15 @@
private NameManager nameManager;
private NamespacePrefixAccumulator prefixAccumulator;
private SchemaInfo schemaInfo;
+
+ private int anyCounter;
+
+ // In general, I (bimargulies) hate fields that are temporary communications
+ // between members of a class. However, given the style restrictions on the number
+ // of parameters, it's the least of the evils.
+ private StringBuilder code;
+ private StringBuilder accessors;
+ private JavascriptUtils utils;
public SchemaJavascriptBuilder(SchemaCollection schemaCollection,
NamespacePrefixAccumulator prefixAccumulator,
@@ -68,7 +79,7 @@
public String generateCodeForSchema(SchemaInfo schema) {
schemaInfo = schema;
- StringBuffer code = new StringBuffer();
+ code = new StringBuilder();
code.append("//\n");
code.append("// Definitions for schema: " + schema.getNamespaceURI());
if (schema.getSystemId() != null) {
@@ -85,9 +96,9 @@
try {
XmlSchemaComplexType complexType = (XmlSchemaComplexType)xmlSchemaObject;
if (complexType.getName() != null) {
- code.append(complexTypeConstructorAndAccessors(complexType.getQName(), complexType));
- code.append(complexTypeSerializerFunction(complexType.getQName(), complexType));
- code.append(domDeserializerFunction(complexType.getQName(), complexType));
+ complexTypeConstructorAndAccessors(complexType.getQName(), complexType);
+ complexTypeSerializerFunction(complexType.getQName(), complexType);
+ domDeserializerFunction(complexType.getQName(), complexType);
}
} catch (UnsupportedConstruct usc) {
LOG.warning(usc.toString());
@@ -127,9 +138,9 @@
XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
// for named types we don't bother to generate for the element.
if (complexType.getName() == null) {
- code.append(complexTypeConstructorAndAccessors(element.getQName(), complexType));
- code.append(complexTypeSerializerFunction(element.getQName(), complexType));
- code.append(domDeserializerFunction(element.getQName(), complexType));
+ complexTypeConstructorAndAccessors(element.getQName(), complexType);
+ complexTypeSerializerFunction(element.getQName(), complexType);
+ domDeserializerFunction(element.getQName(), complexType);
}
} catch (UnsupportedConstruct usc) {
continue; // it could be empty, but the style checker would complain.
@@ -142,99 +153,127 @@
return returnValue;
}
- public String complexTypeConstructorAndAccessors(QName name, XmlSchemaComplexType type) {
- StringBuilder code = new StringBuilder();
- StringBuilder accessors = new StringBuilder();
- JavascriptUtils utils = new JavascriptUtils(code);
+ // In general, I (bimargulies) hate fields that are temporary communications
+ // between members of a class. However, given the style restrictions on the number
+ // of parameters, it's the least of the evils.
+
+ public void complexTypeConstructorAndAccessors(QName name, XmlSchemaComplexType type) {
+ accessors = new StringBuilder();
+ utils = new JavascriptUtils(code);
XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(type);
final String elementPrefix = "this._";
String typeObjectName = nameManager.getJavascriptName(name);
code.append("//\n");
- code.append("// Constructor for XML Schema item " + name.toString() + "\n");
+ code.append("// Constructor for XML Schema item " + name.toString() + "\n");
code.append("//\n");
code.append("function " + typeObjectName + " () {\n");
-
for (int i = 0; i < sequence.getItems().getCount(); i++) {
XmlSchemaObject thing = sequence.getItems().getItem(i);
- if (!(thing instanceof XmlSchemaElement)) {
- XmlSchemaUtils.unsupportedConstruct("NON_ELEMENT_CHILD",
- thing.getClass().getSimpleName(), type);
- }
-
- XmlSchemaElement elChild = (XmlSchemaElement)thing;
- XmlSchemaType elType = XmlSchemaUtils.getElementType(xmlSchemaCollection, null, elChild, type);
+ constructOneElement(type, sequence, elementPrefix, typeObjectName, thing);
+ }
+ code.append("}\n\n");
+ code.append(accessors.toString());
+ }
- boolean nillable = elChild.isNillable();
- if (elChild.isAbstract()) {
- XmlSchemaUtils.unsupportedConstruct("ABSTRACT_ELEMENT", elChild.getName(), type);
- }
-
- // Assume that no lunatic has created multiple elements that differ only by namespace.
- // if elementForm is unqualified, how can that be valid?
- String elementName = elementPrefix + elChild.getName();
- String accessorSuffix = StringUtils.capitalize(elChild.getName());
-
- String accessorName = typeObjectName + "_get" + accessorSuffix;
- String getFunctionProperty = typeObjectName + ".prototype.get" + accessorSuffix;
- String setFunctionProperty = typeObjectName + ".prototype.set" + accessorSuffix;
- code.append("//\n");
- code.append("// accessor is " + getFunctionProperty + "\n");
- code.append("// element get for " + elChild.getName() + "\n");
- // can we get an anonymous type on an element in the middle of a type?
- code.append("// - element type is " + elType.getQName() + "\n");
-
- if (XmlSchemaUtils.isParticleOptional(elChild)) {
- code.append("// - optional element\n");
- } else {
- code.append("// - required element\n");
-
- }
-
- if (XmlSchemaUtils.isParticleArray(elChild)) {
- code.append("// - array\n");
-
+ private void constructOneElement(XmlSchemaComplexType type,
+ XmlSchemaSequence sequence,
+ final String elementPrefix,
+ String typeObjectName,
+ XmlSchemaObject thing) {
+
+ XmlSchemaParticle particle = XmlSchemaUtils.getObjectParticle(thing, type);
+ XmlSchemaElement sequenceElement = null;
+ XmlSchemaType elType = null;
+ boolean nillable = false;
+ String elementName = null;
+ String elementJavascriptVariable = null;
+ String defaultValueString = null;
+ boolean any = false;
+
+ if (particle instanceof XmlSchemaAny) {
+ any = true;
+ // TODO: what about a collision here?
+ elementName = "any" + anyCounter;
+ elementJavascriptVariable = elementPrefix + elementName;
+ anyCounter++;
+ } else {
+ sequenceElement = (XmlSchemaElement)thing;
+ elType = XmlSchemaUtils.getElementType(xmlSchemaCollection, null, sequenceElement, type);
+ nillable = sequenceElement.isNillable();
+ if (sequenceElement.isAbstract()) {
+ XmlSchemaUtils.unsupportedConstruct("ABSTRACT_ELEMENT", sequenceElement.getName(), type);
}
+ elementName = sequenceElement.getName();
+ elementJavascriptVariable = elementPrefix + sequenceElement.getName();
+ defaultValueString = sequenceElement.getDefaultValue();
+ }
+
+
+ String accessorSuffix = StringUtils.capitalize(elementName);
+
+ String accessorName = typeObjectName + "_get" + accessorSuffix;
+ String getFunctionProperty = typeObjectName + ".prototype.get" + accessorSuffix;
+ String setFunctionProperty = typeObjectName + ".prototype.set" + accessorSuffix;
+ accessors.append("//\n");
+ accessors.append("// accessor is " + getFunctionProperty + "\n");
+ accessors.append("// element get for " + elementName + "\n");
+ if (any) {
+ accessors.append("// - xs:any\n");
+ } else {
+ // can we get an anonymous type on an element in the middle of a type?
+ accessors.append("// - element type is " + elType.getQName() + "\n");
+ }
+
+ if (XmlSchemaUtils.isParticleOptional(particle)) {
+ accessors.append("// - optional element\n");
+ } else {
+ accessors.append("// - required element\n");
- if (nillable) {
- code.append("// - nillable\n");
-
- }
- code.append("//\n");
- code.append("// element set for " + elChild.getName() + "\n");
- code.append("// setter function is is " + setFunctionProperty + "\n");
- code.append("//\n");
-
- code.append("//\n");
- accessors.append("function " + accessorName + "() { return " + elementName + ";}\n");
- accessors.append(getFunctionProperty + " = " + accessorName + ";\n");
- accessorName = typeObjectName + "_set" + accessorSuffix;
- accessors.append("function "
- + accessorName + "(value) {" + elementName + " = value;}\n");
- accessors.append(setFunctionProperty + " = " + accessorName + ";\n");
+ }
+
+ if (XmlSchemaUtils.isParticleArray(particle)) {
+ accessors.append("// - array\n");
- if (XmlSchemaUtils.isParticleOptional(elChild)
- || (nillable && !XmlSchemaUtils.isParticleArray(elChild))) {
- utils.appendLine(elementName + " = null;");
- } else if (XmlSchemaUtils.isParticleArray(elChild)) {
- utils.appendLine(elementName + " = [];");
- } else if (elType instanceof XmlSchemaComplexType) {
- // even for required complex elements, we leave them null.
- // otherwise, we could end up in a cycle or otherwise miserable. The
- // application code is responsible for this.
- utils.appendLine(elementName + " = null;");
- } else {
- String defaultValueString = elChild.getDefaultValue();
- if (defaultValueString == null) {
- defaultValueString =
- utils.getDefaultValueForSimpleType(elType);
- }
- utils.appendLine(elementName + " = " + defaultValueString + ";");
+ }
+
+ if (nillable) {
+ accessors.append("// - nillable\n");
+ }
+
+ accessors.append("//\n");
+ accessors.append("// element set for " + elementName + "\n");
+ accessors.append("// setter function is is " + setFunctionProperty + "\n");
+ accessors.append("//\n");
+ accessors.append("function " + accessorName + "() { return "
+ + elementJavascriptVariable
+ + ";}\n");
+ accessors.append(getFunctionProperty + " = " + accessorName + ";\n");
+ accessorName = typeObjectName + "_set" + accessorSuffix;
+ accessors.append("function "
+ + accessorName + "(value) {"
+ + elementJavascriptVariable
+ + " = value;}\n");
+ accessors.append(setFunctionProperty + " = " + accessorName + ";\n");
+
+ if (XmlSchemaUtils.isParticleOptional(particle)
+ || (nillable && !XmlSchemaUtils.isParticleArray(particle))) {
+ utils.appendLine(elementJavascriptVariable + " = null;");
+ } else if (XmlSchemaUtils.isParticleArray(particle)) {
+ utils.appendLine(elementJavascriptVariable + " = [];");
+ } else if (elType instanceof XmlSchemaComplexType) {
+ // even for required complex elements, we leave them null.
+ // otherwise, we could end up in a cycle or otherwise miserable. The
+ // application code is responsible for this.
+ utils.appendLine(elementJavascriptVariable + " = null;");
+ } else {
+ if (defaultValueString == null) {
+ defaultValueString =
+ utils.getDefaultValueForSimpleType(elType);
}
+ utils.appendLine(elementJavascriptVariable + " = " + defaultValueString + ";");
}
- code.append("}\n");
- return code.toString() + "\n" + accessors.toString();
}
@@ -247,7 +286,7 @@
* @param type
* @return
*/
- public String complexTypeSerializerFunction(QName name, XmlSchemaComplexType type) {
+ public void complexTypeSerializerFunction(QName name, XmlSchemaComplexType type) {
StringBuilder bodyCode = new StringBuilder();
JavascriptUtils bodyUtils = new JavascriptUtils(bodyCode);
@@ -255,8 +294,7 @@
complexTypeSerializerBody(type, "this._", bodyUtils);
- StringBuilder code = new StringBuilder();
- JavascriptUtils utils = new JavascriptUtils(code);
+ utils = new JavascriptUtils(code);
String functionName = nameManager.getJavascriptName(name) + "_" + "serialize";
code.append("function " + functionName + "(cxfjsutils, elementName) {\n");
utils.startXmlStringAccumulator("xml");
@@ -279,9 +317,7 @@
utils.endBlock();
utils.appendLine("return xml;");
code.append("}\n");
-
code.append(nameManager.getJavascriptName(name) + ".prototype.serialize = " + functionName + ";\n");
- return code.toString();
}
@@ -295,8 +331,8 @@
* @return
*/
protected void complexTypeSerializerBody(XmlSchemaComplexType type,
- String elementPrefix,
- JavascriptUtils utils) {
+ String elementPrefix,
+ JavascriptUtils bodyUtils) {
XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(type);
@@ -314,7 +350,7 @@
prefixAccumulator);
elementInfo.setContainingType(type);
elementInfo.setUtilsVarName("cxfjsutils");
- utils.generateCodeToSerializeElement(elementInfo, xmlSchemaCollection);
+ bodyUtils.generateCodeToSerializeElement(elementInfo, xmlSchemaCollection);
}
}
@@ -324,9 +360,8 @@
* @param type schema type for the process
* @return the string contents of the JavaScript.
*/
- public String domDeserializerFunction(QName name, XmlSchemaComplexType type) {
- StringBuilder code = new StringBuilder();
- JavascriptUtils utils = new JavascriptUtils(code);
+ public void domDeserializerFunction(QName name, XmlSchemaComplexType type) {
+ utils = new JavascriptUtils(code);
XmlSchemaSequence sequence = null;
sequence = XmlSchemaUtils.getSequence(type);
@@ -434,7 +469,6 @@
}
}
utils.appendLine("return newobject;");
- code.append("}\n");
- return code.toString() + "\n";
+ code.append("}\n\n");
}
}
Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties?rev=606083&r1=606082&r2=606083&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties (original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties Thu Dec 20 17:20:58 2007
@@ -20,10 +20,10 @@
#
# logging for the javascript tests
handlers= java.util.logging.ConsoleHandler
-.level= SEVERE
-java.util.logging.ConsoleHandler.level = SEVERE
+.level= FINE
+java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-#org.apache.cxf.javascript.JavascriptTestUtilities.level=FINEST
+org.apache.cxf.javascript.JavascriptTestUtilities.level=FINEST
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/Cxf1220Test.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/Cxf1220Test.java?rev=606083&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/Cxf1220Test.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/Cxf1220Test.java Thu Dec 20 17:20:58 2007
@@ -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.cxf.cxf1220;
+
+import java.net.URL;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.test.TestUtilities;
+import org.junit.Test;
+
+import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
+
+
+
+/**
+ * CXF-1220 reports an apparent failure to correctly cross-reference schema in a WSDL.
+ */
+@org.junit.Ignore
+public class Cxf1220Test extends AbstractDependencyInjectionSpringContextTests {
+ private TestUtilities testUtilities;
+
+ public Cxf1220Test() {
+ setAutowireMode(AbstractDependencyInjectionSpringContextTests.AUTOWIRE_BY_NAME);
+ testUtilities = new TestUtilities(getClass());
+ }
+
+ @Test
+ public void testJaxbCrossSchemaImport() throws Exception {
+ testUtilities.setBus((Bus)applicationContext.getBean("cxf"));
+ testUtilities.addDefaultNamespaces();
+ JaxWsServerFactoryBean serverFactory = (JaxWsServerFactoryBean)applicationContext.getBean("server");
+ Server s = serverFactory.getServer();
+ URL url = new URL("http://localhost:7081/Cxf1220?wsdl");
+ String wsdlString = IOUtils.toString(url.openStream());
+ assertNotNull(wsdlString);
+ Document wsdl = testUtilities.getWSDLDocument(s);
+ testUtilities.
+ assertValid("//xsd:schema[@targetNamespace='http://apache.org/type_test/doc']/"
+ + "xsd:import[@namespace='http://apache.org/type_test/types1']", wsdl);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.springframework.test.AbstractSingleSpringContextTests#getConfigLocations()
+ */
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[] {"classpath:cxf1220Beans.xml"};
+ }
+
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/Cxf1220Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/Cxf1220Test.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/Bean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/Bean.java?rev=606083&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/Bean.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/Bean.java Thu Dec 20 17:20:58 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.cxf.cxf1220.bean;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.cxf.cxf1220.useenum.RefEnumInAttribute;
+
+/**
+ * This object lives in it's own namespace to model the structure of the
+ * original report.
+ */
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "OrderType")
+public class Bean {
+ @XmlElement(name = "REF_ENUM",
+ namespace = "urn:oasis:names:draft:ubl:schema:xsd:CommonBasicComponents-2",
+ required = true)
+ protected RefEnumInAttribute refEnum;
+
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/Bean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/Bean.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/package-info.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/package-info.java?rev=606083&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/package-info.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/package-info.java Thu Dec 20 17:20:58 2007
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "urn:oasis:names:draft:ubl:schema:xsd:Order-2",
+ elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.cxf.cxf1220.bean;
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/bean/package-info.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/hasenum/BasicEnum.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/hasenum/BasicEnum.java?rev=606083&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/hasenum/BasicEnum.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/hasenum/BasicEnum.java Thu Dec 20 17:20:58 2007
@@ -0,0 +1,37 @@
+/**
+ * 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.cxf.cxf1220.hasenum;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum BasicEnum {
+ Alpha,
+ Bravo,
+ Charlie;
+
+ public String value() {
+ return name();
+ }
+
+ public static BasicEnum fromValue(String v) {
+ return valueOf(v);
+ }
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/hasenum/BasicEnum.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/hasenum/BasicEnum.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220.java?rev=606083&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220.java Thu Dec 20 17:20:58 2007
@@ -0,0 +1,35 @@
+/**
+ * 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.cxf.cxf1220.service;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+import org.apache.cxf.cxf1220.bean.Bean;
+
+/**
+ *
+ */
+@WebService
+public interface Cxf1220 {
+ @WebMethod
+ void doSomething(@WebParam (name = "b") Bean bean);
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220Impl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220Impl.java?rev=606083&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220Impl.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220Impl.java Thu Dec 20 17:20:58 2007
@@ -0,0 +1,38 @@
+/**
+ * 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.cxf.cxf1220.service;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+import org.apache.cxf.cxf1220.bean.Bean;
+
+/**
+ *
+ */
+@WebService
+public class Cxf1220Impl implements Cxf1220 {
+
+ /** {@inheritDoc}*/
+ @WebMethod
+ public void doSomething(Bean bean) {
+ }
+
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220Impl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/service/Cxf1220Impl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/RefEnumInAttribute.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/RefEnumInAttribute.java?rev=606083&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/RefEnumInAttribute.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/RefEnumInAttribute.java Thu Dec 20 17:20:58 2007
@@ -0,0 +1,55 @@
+/**
+ * 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.cxf.cxf1220.useenum;
+
+import java.math.BigDecimal;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.apache.cxf.cxf1220.hasenum.BasicEnum;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "AmountType", propOrder = {"value" })
+public class RefEnumInAttribute {
+ @XmlValue
+ protected BigDecimal value;
+ @XmlAttribute(required = true)
+ protected BasicEnum enumeratedValue;
+
+ public BigDecimal getValue() {
+ return value;
+ }
+
+ public void setValue(BigDecimal value) {
+ this.value = value;
+ }
+
+ public BasicEnum getEnumerated() {
+ return enumeratedValue;
+ }
+
+ public void setEnumerated(BasicEnum newValue) {
+ this.enumeratedValue = newValue;
+ }
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/RefEnumInAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/RefEnumInAttribute.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/package-info.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/package-info.java?rev=606083&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/package-info.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/package-info.java Thu Dec 20 17:20:58 2007
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+@javax.xml.bind.annotation.XmlSchema(namespace =
+ "urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2")
+package org.apache.cxf.cxf1220.useenum;
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/cxf1220/useenum/package-info.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/resources/cxf1220Beans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/resources/cxf1220Beans.xml?rev=606083&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/resources/cxf1220Beans.xml (added)
+++ incubator/cxf/trunk/systests/src/test/resources/cxf1220Beans.xml Thu Dec 20 17:20:58 2007
@@ -0,0 +1,44 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+ http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">
+
+
+
+ <!-- CXF -->
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-local.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+
+ <!-- Services -->
+ <jaxws:server id="server"
+ serviceClass="org.apache.cxf.cxf1220.service.Cxf1220Impl"
+ address="http://localhost:7081/Cxf1220">
+ </jaxws:server>
+</beans>
+
Propchange: incubator/cxf/trunk/systests/src/test/resources/cxf1220Beans.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/systests/src/test/resources/cxf1220Beans.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml