Author: bimargulies
Date: Sat May 17 16:59:15 2008
New Revision: 657480
URL: http://svn.apache.org/viewvc?rev=657480&view=rev
Log:
Extend qualification control to XML .aegis files.
Added:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.aegis.xml
(with props)
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.java
(with props)
Modified:
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AttributeBean.java
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java
Modified:
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java?rev=657480&r1=657479&r2=657480&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
(original)
+++
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
Sat May 17 16:59:15 2008
@@ -359,7 +359,9 @@
} else {
btinfo.setExtensibleAttributes(getConfiguration().isDefaultExtensibleAttributes());
}
-
+
+
btinfo.setQualifyAttributes(this.getConfiguration().isQualifyAttributes());
+
btinfo.setQualifyElements(this.getConfiguration().isQualifyElements());
BeanType type = new BeanType(btinfo);
if (name == null) {
Modified:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AttributeBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AttributeBean.java?rev=657480&r1=657479&r2=657480&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AttributeBean.java
(original)
+++
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AttributeBean.java
Sat May 17 16:59:15 2008
@@ -26,10 +26,9 @@
*/
public class AttributeBean {
private String attrPlainString = "attrPlain";
- private String attrXmlString = "attrXml";
private String attrExplicitString = "attrExplicit";
- @XmlAttribute (namespace = "")
+ @XmlAttribute
public String getAttrPlainString() {
return attrPlainString;
}
@@ -38,14 +37,6 @@
this.attrPlainString = plainString;
}
- public String getAttrXmlString() {
- return attrXmlString;
- }
-
- public void setAttrXmlString(String attrXmlString) {
- this.attrXmlString = attrXmlString;
- }
-
@XmlAttribute (namespace = "urn:xyzzy")
public String getAttrExplicitString() {
return attrExplicitString;
Added:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.aegis.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.aegis.xml?rev=657480&view=auto
==============================================================================
---
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.aegis.xml
(added)
+++
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.aegis.xml
Sat May 17 16:59:15 2008
@@ -0,0 +1,24 @@
+<?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.
+-->
+<mappings>
+ <mapping>
+ <property name='attrXmlString' style='attribute'/>
+ </mapping>
+</mappings>
Propchange:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.aegis.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.aegis.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.aegis.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.java?rev=657480&view=auto
==============================================================================
---
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.java
(added)
+++
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.java
Sat May 17 16:59:15 2008
@@ -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.aegis.services;
+
+/**
+ * Test class for attribute forms.
+ */
+public class XmlMappedAttributeBean {
+ private String attrXmlString = "attrXml";
+
+ public String getAttrXmlString() {
+ return attrXmlString;
+ }
+
+ public void setAttrXmlString(String attrXmlString) {
+ this.attrXmlString = attrXmlString;
+ }
+}
Propchange:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/XmlMappedAttributeBean.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java?rev=657480&r1=657479&r2=657480&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java
(original)
+++
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java
Sat May 17 16:59:15 2008
@@ -24,6 +24,7 @@
import org.apache.cxf.aegis.AegisContext;
import org.apache.cxf.aegis.Context;
import org.apache.cxf.aegis.services.AttributeBean;
+import org.apache.cxf.aegis.services.XmlMappedAttributeBean;
import org.apache.cxf.aegis.type.Type;
import org.apache.cxf.aegis.type.TypeCreationOptions;
import org.apache.cxf.aegis.type.TypeMapping;
@@ -40,11 +41,12 @@
addNamespace("b", "urn:Bean");
addNamespace("xyzzy", "urn:xyzzy");
+ addNamespace("pkg", "http://services.aegis.cxf.apache.org");
addNamespace("xsi", SOAPConstants.XSI_NS);
}
@Test
- public void testDefaultUnqualifiedAttribute() throws Exception {
+ public void testAnnotatedDefaultUnqualifiedAttribute() throws Exception {
AegisContext context = new AegisContext();
context.initialize();
TypeMapping mapping = context.getTypeMapping();
@@ -64,7 +66,7 @@
}
@Test
- public void testDefaultQualifiedAttribute() throws Exception {
+ public void testAnnotatedDefaultQualifiedAttribute() throws Exception {
AegisContext context = new AegisContext();
TypeCreationOptions typeCreationOptions =
new TypeCreationOptions();
@@ -83,7 +85,48 @@
type.writeObject(bean, new JDOMWriter(element), messageContext);
assertValid("/b:[EMAIL PROTECTED]:attrExplicitString]", element);
assertXPathEquals("/b:root/@xyzzy:attrExplicitString", "attrExplicit",
element);
- assertValid("/b:[EMAIL PROTECTED]", element);
- assertXPathEquals("/b:root/@attrPlainString", "attrPlain", element);
+ assertValid("/b:[EMAIL PROTECTED]:attrPlainString]", element);
+ assertXPathEquals("/b:root/@pkg:attrPlainString", "attrPlain",
element);
}
+ @Test
+ public void testXmlDefaultUnqualifiedAttribute() throws Exception {
+ AegisContext context = new AegisContext();
+ context.initialize();
+ TypeMapping mapping = context.getTypeMapping();
+
+ Type type =
mapping.getTypeCreator().createType(XmlMappedAttributeBean.class);
+ type.setSchemaType(new QName("urn:Bean", "bean"));
+
+ Context messageContext = new Context(context);
+ Element element = new Element("root", "b", "urn:Bean");
+ new Document(element);
+ XmlMappedAttributeBean bean = new XmlMappedAttributeBean();
+ type.writeObject(bean, new JDOMWriter(element), messageContext);
+ assertValid("/b:[EMAIL PROTECTED]", element);
+ assertXPathEquals("/b:root/@attrXmlString", "attrXml", element);
+ }
+
+ @Test
+ public void testXmlDefaultQualifiedAttribute() throws Exception {
+ AegisContext context = new AegisContext();
+ TypeCreationOptions typeCreationOptions =
+ new TypeCreationOptions();
+ typeCreationOptions.setQualifyAttributes(true);
+ context.setTypeCreationOptions(typeCreationOptions);
+ context.initialize();
+ TypeMapping mapping = context.getTypeMapping();
+
+ Type type =
mapping.getTypeCreator().createType(XmlMappedAttributeBean.class);
+ type.setSchemaType(new QName("urn:Bean", "bean"));
+
+ Context messageContext = new Context(context);
+ Element element = new Element("root", "b", "urn:Bean");
+ new Document(element);
+ XmlMappedAttributeBean bean = new XmlMappedAttributeBean();
+ type.writeObject(bean, new JDOMWriter(element), messageContext);
+ assertValid("/b:[EMAIL PROTECTED]:attrXmlString]", element);
+ assertXPathEquals("/b:root/@pkg:attrXmlString", "attrXml", element);
+ }
+
+
}