Skip to content
Permalink
Browse files
[CXF-3131] Fix problem of XmlElemtn annotions being removed
Update builds for latest plugins and config and such


git-svn-id: https://svn.apache.org/repos/asf/cxf/xjc-utils/trunk@1056596 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
dkulp committed Jan 8, 2011
1 parent 624273f commit cf9a6547f2a39bb2afff9984c5fe7f0609b52c41
Showing 4 changed files with 30 additions and 28 deletions.
@@ -19,10 +19,12 @@

package org.apache.cxf.xjc.dv;

import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.BigInteger;

import javax.xml.bind.DatatypeConverter;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import javax.xml.namespace.QName;

@@ -43,12 +45,18 @@ public void testFooDefaultValues() throws Exception {
Foo foo = new org.apache.cxf.configuration.foo.ObjectFactory().createFoo();

// verify default values
checkCXF3131(foo);

assertAttributeValuesWithoutDefault(foo);
assertDefaultAttributeValues(foo);
assertDefaultElementValues(foo);
}

private void checkCXF3131(Foo foo) throws Exception {
Field f = foo.getClass().getDeclaredField("point");
assertNotNull(f.getAnnotation(XmlElement.class));
}

private void assertDefaultAttributeValues(Foo foo) {
assertEquals("Unexpected value for attribute stringAttr",
"hello", foo.getStringAttr());
@@ -52,9 +52,9 @@
<xs:sequence>
<xs:element name="pageColor" type="tns:pageColor" minOccurs="0"></xs:element>
<xs:element name="driving" type="tns:drivingDecision" default="LeftTurn" minOccurs="0"></xs:element>
<xs:element name="stringElem" type="xs:string" default="hello" minOccurs="0"></xs:element>
<xs:element name="booleanElem" type="xs:boolean" default="true" minOccurs="0"></xs:element>
<xs:element name="integerElem" type="xs:integer" default="11" minOccurs="0"></xs:element>
<xs:element name="StringElem" type="xs:string" default="hello" minOccurs="0"></xs:element>
<xs:element name="BooleanElem" type="xs:boolean" default="true" minOccurs="0"></xs:element>
<xs:element name="IntegerElem" type="xs:integer" default="11" minOccurs="0"></xs:element>
<xs:element name="intElem" type="xs:int" default="12" minOccurs="0"></xs:element>
<xs:element name="longElem" type="xs:long" default="13" minOccurs="0"></xs:element>
<xs:element name="shortElem" type="xs:short" default="14" minOccurs="0"></xs:element>
@@ -72,9 +72,9 @@
<xs:element name="temperature" type="tns:celsius" default="37" minOccurs="0"></xs:element>
<xs:element name="roomTemperature" type="tns:cel" default="38" minOccurs="0"></xs:element>

<xs:element name="point" type="tns:point" minOccurs="0"></xs:element>
<xs:element name="Point" type="tns:point" minOccurs="0"></xs:element>

<xs:element name="address" minOccurs="0">
<xs:element name="Address" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="city" type="xs:string"></xs:element>
@@ -125,8 +125,8 @@

<xs:complexType name="point">
<xs:sequence>
<xs:element name="x" type="xs:int"></xs:element>
<xs:element name="y" type="xs:int"></xs:element>
<xs:element name="X" type="xs:int" default="0" minOccurs="0"></xs:element>
<xs:element name="Y" type="xs:int" default="0" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>

@@ -136,13 +136,7 @@ public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) {
String varName = f.getPropertyInfo().getName(false);
JFieldVar var = co.implClass.fields().get(varName);
if (var != null) {
co.implClass.removeField(var);

JFieldVar newVar = co.implClass.field(var.mods().getValue(),
var.type(),
var.name(),
JExpr._new(f.getRawType()));
newVar.javadoc().append(var.javadoc());
var.init(JExpr._new(f.getRawType()));
}
}

28 pom.xml
@@ -39,10 +39,6 @@
<properties>
<jdk.version>1.6</jdk.version>

<jaxb.version>2.1</jaxb.version>
<jaxb.xjc.version>2.1.12</jaxb.xjc.version>
<jaxb.impl.version>2.1.12</jaxb.impl.version>

<eclipse.outputDirectory>${basedir}/target/classes</eclipse.outputDirectory>
<downloadSources>true</downloadSources>

@@ -87,12 +83,12 @@
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.12</version>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.1.12</version>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -233,11 +229,15 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<reportFormat>brief</reportFormat>
<useFile>false</useFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<version>2.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
@@ -294,7 +294,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.0.1</version>
<version>3.0-beta-3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -309,7 +309,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.1.1</version>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -319,7 +319,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<version>2.8</version>
<configuration>
<outputDirectory>${eclipse.outputDirectory}</outputDirectory>
<buildcommands>
@@ -352,19 +352,19 @@
<dependency>
<groupId>org.apache.cxf.build-utils</groupId>
<artifactId>cxf-buildtools</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.5</version>
<version>2.6</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf.build-utils</groupId>
<artifactId>cxf-buildtools</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
</dependencies>
<configuration>
@@ -397,7 +397,7 @@
<dependency>
<groupId>org.apache.cxf.build-utils</groupId>
<artifactId>cxf-buildtools</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
</dependencies>
<configuration>

0 comments on commit cf9a654

Please sign in to comment.