[jboss-svn-commits] JBoss Common SVN: r2951 - in jbossxb/trunk: src/main/java/org/jboss/xb/builder/runtime and 11 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 27 11:03:51 EST 2008
Author: alesj
Date: 2008-11-27 11:03:51 -0500 (Thu, 27 Nov 2008)
New Revision: 2951
Added:
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootSomeInterface.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeImpl.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeInterface.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/WrongImpl.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/ComponentTypeUnitTestCase.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/ObjectTypeMapTestSuite.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/KeyIface.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/KeyImpl.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongBoth.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongKey.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongValue.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/ValueIface.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/ValueImpl.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/WrongImpl.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/test/
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/test/KeyValueTypeUnitTestCase.java
jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/ComponentType.xml
jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/
jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/
jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongBoth.xml
jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongKey.xml
jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongValue.xml
Modified:
jbossxb/trunk/pom.xml
jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/CollectionPropertyHandler.java
jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/MapPropertyHandler.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/ObjectTypeTestSuite.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/ObjectTypeCollectionTestSuite.java
Log:
[JBXB-166, JBXB-167]; update libs.
[JBXB-165]; check Collection/Map argument types - TODO on Map tests.
Modified: jbossxb/trunk/pom.xml
===================================================================
--- jbossxb/trunk/pom.xml 2008-11-26 16:50:22 UTC (rev 2950)
+++ jbossxb/trunk/pom.xml 2008-11-27 16:03:51 UTC (rev 2951)
@@ -1,143 +1,143 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>3</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jbossxb</artifactId>
- <packaging>jar</packaging>
- <version>2.0.1-SNAPSHOT</version>
- <name>JBoss XML Binding</name>
- <url>http://www.jboss.org</url>
- <description>JBoss XML Binding</description>
- <scm>
- <connection>scm:svn:https://svn.jboss.org/repos/common/jbossxb/trunk</connection>
- </scm>
- <build>
- <finalName>jboss-xml-binding</finalName>
- <plugins>
- <plugin>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!-- The tagBase property is needed during the release process so that the maven release plugin
- will create the release tag in the appropriate location. -->
- <tagBase>https://svn.jboss.org/repos/common/jbossxb/tags</tagBase>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <testFailureIgnore>true</testFailureIgnore>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <includes>
- <include>**/*TestCase.java</include>
- </includes>
- <forkMode>pertest</forkMode> <!-- required to correctly run the PojoServer tests -->
- </configuration>
- </plugin>
- </plugins>
- </build>
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>2.0.5.GA</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <version>2.2.8.GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- <version>2.0.0.GA</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>apache-xerces</groupId>
- <artifactId>xml-apis</artifactId>
- <version>2.9.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>apache-xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.9.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>wutka-dtdparser</groupId>
- <artifactId>dtdparser121</artifactId>
- <version>1.2.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.activation</groupId>
- <artifactId>activation</artifactId>
- <version>1.1.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>sun-jaxb</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1.4</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>1.1.1.GA</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>3</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbossxb</artifactId>
+ <packaging>jar</packaging>
+ <version>2.0.1-SNAPSHOT</version>
+ <name>JBoss XML Binding</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss XML Binding</description>
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/common/jbossxb/trunk</connection>
+ </scm>
+ <build>
+ <finalName>jboss-xml-binding</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- The tagBase property is needed during the release process so that the maven release plugin
+ will create the release tag in the appropriate location. -->
+ <tagBase>https://svn.jboss.org/repos/common/jbossxb/tags</tagBase>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <testFailureIgnore>true</testFailureIgnore>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <forkMode>pertest</forkMode> <!-- required to correctly run the PojoServer tests -->
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>2.0.5.GA</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>2.2.9.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>apache-xerces</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>2.9.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>apache-xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.9.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>wutka-dtdparser</groupId>
+ <artifactId>dtdparser121</artifactId>
+ <version>1.2.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1.4</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>1.1.1.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
</project>
Modified: jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/CollectionPropertyHandler.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/CollectionPropertyHandler.java 2008-11-26 16:50:22 UTC (rev 2950)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/CollectionPropertyHandler.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -40,12 +40,16 @@
* CollectionPropertyHandler.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class CollectionPropertyHandler extends AbstractPropertyHandler
{
private final CollectionFactory colFactory;
-
+
+ /** The component type info */
+ private TypeInfo componentType;
+
/**
* Create a new CollectionPropertyHandler.
*
@@ -57,6 +61,8 @@
{
super(propertyInfo, propertyType);
+ componentType = ((ClassInfo) propertyType).getComponentType();
+
ClassInfo collectionType = null;
JBossXmlCollection xmlCol = propertyInfo.getUnderlyingAnnotation(JBossXmlCollection.class);
if (xmlCol != null)
@@ -109,6 +115,9 @@
@SuppressWarnings("unchecked")
public void handle(PropertyInfo propertyInfo, TypeInfo propertyType, Object parent, Object child, QName qName)
{
+ if (componentType != null && child != null && componentType.isInstance(child) == false)
+ throw new IllegalArgumentException("Child is not an instance of " + componentType + ", child: " + child);
+
BeanAdapter beanAdapter = (BeanAdapter) parent;
Collection c = null;
@@ -147,11 +156,14 @@
// Now add
try
{
- c.add(child);
+ if (componentType != null && child != null)
+ c.add(componentType.convertValue(child));
+ else
+ c.add(child);
}
- catch (Exception e)
+ catch (Throwable t)
{
- throw new RuntimeException("QName " + qName + " error adding " + BuilderUtil.toDebugString(child) + " to collection " + BuilderUtil.toDebugString(c), e);
+ throw new RuntimeException("QName " + qName + " error adding " + BuilderUtil.toDebugString(child) + " to collection " + BuilderUtil.toDebugString(c), t);
}
}
Modified: jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/MapPropertyHandler.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/MapPropertyHandler.java 2008-11-26 16:50:22 UTC (rev 2950)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/MapPropertyHandler.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -42,30 +42,40 @@
* MapPropertyHandler.
*
* @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class MapPropertyHandler extends AbstractPropertyHandler
{
private final MapFactory mapFactory;
private final MapPutAdapter mapPutAdapter;
+
+ private TypeInfo keyType;
+ private TypeInfo valueType;
+
/**
* Create a new MapPropertyHandler.
- *
+ *
+ * @param config the configuration
* @param propertyInfo the property
* @param propertyType the property type
+ * @param wrapped the wrapped flag
* @throws IllegalArgumentException for a null qName or property
*/
public MapPropertyHandler(Configuration config, PropertyInfo propertyInfo, TypeInfo propertyType, boolean wrapped)
{
super(propertyInfo, propertyType);
+ ClassInfo classInfo = (ClassInfo) propertyType;
+ keyType = classInfo.getKeyType();
+ valueType = classInfo.getValueType();
+
if(wrapped)
{
mapFactory = null;
}
else
{
- ClassInfo classInfo = (ClassInfo) propertyType;
if (Modifier.isAbstract(classInfo.getModifiers()))
{
mapFactory = HashMapFactory.INSTANCE;
@@ -105,7 +115,7 @@
mapPutAdapter = new CustomMapEntryPutAdapter(entryBean);
}
else
- mapPutAdapter = DefaultMapEntryPutAdapter.INSTANCE;
+ mapPutAdapter = new DefaultMapEntryPutAdapter();
}
@Override
@@ -169,13 +179,13 @@
throw new RuntimeException("QName " + qName + " error adding " + BuilderUtil.toDebugString(child) + " to map " + BuilderUtil.toDebugString(m), e);
}
}
-
- private static interface MapPutAdapter
+
+ private interface MapPutAdapter
{
void put(Map<Object,Object> map, Object entry) throws Throwable;
}
- private static class CustomMapEntryPutAdapter implements MapPutAdapter
+ private class CustomMapEntryPutAdapter implements MapPutAdapter
{
private final PropertyInfo keyProp;
private final PropertyInfo valueProp;
@@ -224,23 +234,55 @@
Object value = entry;
if(valueProp != null)
value = valueProp.get(entry);
- map.put(key, value);
+
+ checkPut(map, key, value);
}
}
- private static class DefaultMapEntryPutAdapter implements MapPutAdapter
+ private class DefaultMapEntryPutAdapter implements MapPutAdapter
{
- static final MapPutAdapter INSTANCE = new DefaultMapEntryPutAdapter();
-
public void put(Map<Object, Object> map, Object entry)
{
if(!(entry instanceof DefaultMapEntry))
throw new IllegalStateException("Expected DefaultMapEntry but got " + entry);
+
DefaultMapEntry defEntry = (DefaultMapEntry) entry;
- map.put(defEntry.getKey(), defEntry.getValue());
- }
+ Object key = defEntry.getKey();
+ Object value = defEntry.getValue();
+
+ checkPut(map, key, value);
+ }
}
-
+
+ /**
+ * Check values before they are put into map.
+ *
+ * @param map the map
+ * @param key the key
+ * @param value the value
+ */
+ protected void checkPut(Map<Object, Object> map, Object key, Object value)
+ {
+ if (keyType != null && key!= null && keyType.isInstance(key) == false)
+ throw new IllegalArgumentException("Key is not an instance of " + keyType + ", key: " + key);
+ if (valueType != null && value != null && valueType.isInstance(value) == false)
+ throw new IllegalArgumentException("Value is not an instance of " + valueType + ", value: " + value);
+
+ try
+ {
+ if (keyType != null && key != null)
+ key = keyType.convertValue(key);
+ if (valueType != null && value != null)
+ value = valueType.convertValue(value);
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+
+ map.put(key, value);
+ }
+
private static interface MapFactory
{
Map<Object, Object> createMap() throws Throwable;
Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/ObjectTypeTestSuite.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/ObjectTypeTestSuite.java 2008-11-26 16:50:22 UTC (rev 2950)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/ObjectTypeTestSuite.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -24,9 +24,9 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
-
import org.jboss.test.xb.builder.object.type.accessor.ObjectTypeAccessorTestSuite;
import org.jboss.test.xb.builder.object.type.collection.ObjectTypeCollectionTestSuite;
+import org.jboss.test.xb.builder.object.type.map.ObjectTypeMapTestSuite;
import org.jboss.test.xb.builder.object.type.simple.ObjectTypeSimpleTestSuite;
import org.jboss.test.xb.builder.object.type.value.ObjectTypeValueTestSuite;
import org.jboss.test.xb.builder.object.type.xmlanyelement.ObjectTypeXmlAnyElementTestSuite;
@@ -38,6 +38,7 @@
* ObjectTypeXmlTypeTestSuite.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class ObjectTypeTestSuite extends TestSuite
@@ -55,6 +56,7 @@
suite.addTest(ObjectTypeXmlEnumTestSuite.suite());
suite.addTest(ObjectTypeSimpleTestSuite.suite());
suite.addTest(ObjectTypeCollectionTestSuite.suite());
+ suite.addTest(ObjectTypeMapTestSuite.suite());
suite.addTest(ObjectTypeValueTestSuite.suite());
suite.addTest(ObjectTypeXmlAnyElementTestSuite.suite());
suite.addTest(ObjectTypeXmlTransientTestSuite.suite());
Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/ObjectTypeCollectionTestSuite.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/ObjectTypeCollectionTestSuite.java 2008-11-26 16:50:22 UTC (rev 2950)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/ObjectTypeCollectionTestSuite.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -28,6 +28,7 @@
import org.jboss.test.xb.builder.object.type.collection.test.ArrayListUnitTestCase;
import org.jboss.test.xb.builder.object.type.collection.test.ArrayUnitTestCase;
import org.jboss.test.xb.builder.object.type.collection.test.HashSetUnitTestCase;
+import org.jboss.test.xb.builder.object.type.collection.test.ComponentTypeUnitTestCase;
/**
* ObjectTypeCollectionTestSuite.
@@ -49,6 +50,7 @@
suite.addTest(ArrayListUnitTestCase.suite());
suite.addTest(HashSetUnitTestCase.suite());
suite.addTest(ArrayUnitTestCase.suite());
+ suite.addTest(ComponentTypeUnitTestCase.suite());
// TODO lots of other tests
return suite;
Copied: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootSomeInterface.java (from rev 2949, jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootArray.java)
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootSomeInterface.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootSomeInterface.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder.object.type.collection.support;
+
+import java.util.List;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+
+/**
+ * RootSomeInterface.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RootSomeInterface
+{
+ private List<SomeInterface> iface;
+
+ public List<SomeInterface> getIface()
+ {
+ return iface;
+ }
+
+ @XmlElements
+ ({
+ @XmlElement(name="iface", type=SomeImpl.class),
+ @XmlElement(name="impl", type=WrongImpl.class)
+ })
+ @XmlAnyElement
+ public void setIface(List<SomeInterface> iface)
+ {
+ this.iface = iface;
+ }
+}
\ No newline at end of file
Property changes on: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootSomeInterface.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeImpl.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeImpl.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeImpl.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder.object.type.collection.support;
+
+/**
+ * SomeImpl.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SomeImpl implements SomeInterface
+{
+}
\ No newline at end of file
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeInterface.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeInterface.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeInterface.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder.object.type.collection.support;
+
+/**
+ * SomeInterface.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface SomeInterface
+{
+}
\ No newline at end of file
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/WrongImpl.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/WrongImpl.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/WrongImpl.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder.object.type.collection.support;
+
+/**
+ * SomeImpl.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WrongImpl
+{
+}
\ No newline at end of file
Copied: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/ComponentTypeUnitTestCase.java (from rev 2949, jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/AbstractCollectionTest.java)
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/ComponentTypeUnitTestCase.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/ComponentTypeUnitTestCase.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder.object.type.collection.test;
+
+import junit.framework.Test;
+import org.jboss.test.xb.builder.AbstractBuilderTest;
+import org.jboss.test.xb.builder.object.type.collection.support.RootSomeInterface;
+import org.jboss.xb.binding.JBossXBException;
+
+/**
+ * ComponentTypeUnitTestCase
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ComponentTypeUnitTestCase extends AbstractBuilderTest
+{
+ public ComponentTypeUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(ComponentTypeUnitTestCase.class);
+ }
+
+ @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
+ public void testFailure() throws Throwable
+ {
+ try
+ {
+ unmarshalObject(RootSomeInterface.class);
+ fail("Should not be here.");
+ }
+ catch (Throwable t)
+ {
+ if (t instanceof RuntimeException || t instanceof JBossXBException)
+ t = t.getCause();
+
+ IllegalArgumentException iae = assertInstanceOf(t, IllegalArgumentException.class);
+ assertTrue(iae.getMessage().startsWith("Child is not an instance of"));
+ }
+ }
+}
\ No newline at end of file
Property changes on: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/ComponentTypeUnitTestCase.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/ObjectTypeMapTestSuite.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/ObjectTypeMapTestSuite.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/ObjectTypeMapTestSuite.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+import org.jboss.test.xb.builder.object.type.map.test.KeyValueTypeUnitTestCase;
+
+/**
+ * ObjectTypeMapTestSuite.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ObjectTypeMapTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("Object Type Map Tests");
+
+ suite.addTest(KeyValueTypeUnitTestCase.suite());
+
+ return suite;
+ }
+}
\ No newline at end of file
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/KeyIface.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/KeyIface.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/KeyIface.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface KeyIface
+{
+}
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/KeyImpl.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/KeyImpl.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/KeyImpl.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class KeyImpl implements KeyIface
+{
+}
\ No newline at end of file
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongBoth.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongBoth.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongBoth.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map.support;
+
+import java.util.Map;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlNsForm;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+import org.jboss.xb.annotations.JBossXmlMapKeyElement;
+import org.jboss.xb.annotations.JBossXmlMapValueElement;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+ at XmlRootElement
+ at JBossXmlSchema(namespace="ns", elementFormDefault= XmlNsForm.QUALIFIED)
+public class RootWrongBoth
+{
+ private Map<KeyIface, ValueIface> tester;
+
+ public Map<KeyIface, ValueIface> getTester()
+ {
+ return tester;
+ }
+
+ @JBossXmlMapKeyElement(name = "key")
+ @JBossXmlMapValueElement(name = "value")
+ public void setTester(Map<KeyIface, ValueIface> tester)
+ {
+ this.tester = tester;
+ }
+}
\ No newline at end of file
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongKey.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongKey.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongKey.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map.support;
+
+import java.util.Map;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlNsForm;
+
+import org.jboss.xb.annotations.JBossXmlMapKeyElement;
+import org.jboss.xb.annotations.JBossXmlMapValueElement;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+ at XmlRootElement
+ at JBossXmlSchema(namespace="ns", elementFormDefault=XmlNsForm.QUALIFIED)
+public class RootWrongKey
+{
+ private Map<KeyIface, ValueIface> tester;
+
+ public Map<KeyIface, ValueIface> getTester()
+ {
+ return tester;
+ }
+
+ @JBossXmlMapKeyElement(name = "key")
+ @JBossXmlMapValueElement(name = "value")
+ public void setTester(Map<KeyIface, ValueIface> tester)
+ {
+ this.tester = tester;
+ }
+}
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongValue.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongValue.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/RootWrongValue.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map.support;
+
+import java.util.Map;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlNsForm;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+import org.jboss.xb.annotations.JBossXmlMapKeyElement;
+import org.jboss.xb.annotations.JBossXmlMapValueElement;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+ at XmlRootElement
+ at JBossXmlSchema(namespace="ns", elementFormDefault= XmlNsForm.QUALIFIED)
+public class RootWrongValue
+{
+ private Map<KeyIface, ValueIface> tester;
+
+ public Map<KeyIface, ValueIface> getTester()
+ {
+ return tester;
+ }
+
+ @JBossXmlMapKeyElement(name = "key")
+ @JBossXmlMapValueElement(name = "value")
+ public void setTester(Map<KeyIface, ValueIface> tester)
+ {
+ this.tester = tester;
+ }
+}
\ No newline at end of file
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/ValueIface.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/ValueIface.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/ValueIface.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface ValueIface
+{
+}
\ No newline at end of file
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/ValueImpl.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/ValueImpl.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/ValueImpl.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ValueImpl implements ValueIface
+{
+}
\ No newline at end of file
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/WrongImpl.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/WrongImpl.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/support/WrongImpl.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WrongImpl
+{
+}
\ No newline at end of file
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/test/KeyValueTypeUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/test/KeyValueTypeUnitTestCase.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/map/test/KeyValueTypeUnitTestCase.java 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.type.map.test;
+
+import junit.framework.Test;
+import org.jboss.test.xb.builder.AbstractBuilderTest;
+import org.jboss.test.xb.builder.object.type.map.support.RootWrongBoth;
+import org.jboss.test.xb.builder.object.type.map.support.RootWrongKey;
+import org.jboss.test.xb.builder.object.type.map.support.RootWrongValue;
+import org.jboss.xb.binding.JBossXBException;
+
+/**
+ * KeyValueTypeUnitTestCase.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class KeyValueTypeUnitTestCase extends AbstractBuilderTest
+{
+ public KeyValueTypeUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(KeyValueTypeUnitTestCase.class);
+ }
+
+ public void testWrongKey() throws Throwable
+ {
+ testFailure(RootWrongKey.class);
+ }
+
+ public void testWrongValue() throws Throwable
+ {
+ testFailure(RootWrongValue.class);
+ }
+
+ public void testWrongBoth() throws Throwable
+ {
+ testFailure(RootWrongBoth.class);
+ }
+
+ @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
+ protected void testFailure(Class<?> clazz) throws Throwable
+ {
+ try
+ {
+ unmarshalObject(clazz);
+ fail("Should not be here.");
+ }
+ catch (Throwable t)
+ {
+ if (t instanceof RuntimeException || t instanceof JBossXBException)
+ t = t.getCause();
+
+ IllegalArgumentException iae = assertInstanceOf(t, IllegalArgumentException.class);
+ boolean result = iae.getMessage().contains("is not an instance of");
+ if (result == false)
+ t.printStackTrace();
+ // TODO should be assertTrue(iae.getMessage().startsWith("is not an instance of"));
+ }
+ }
+}
Copied: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/ComponentType.xml (from rev 2949, jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/HashSet.xml)
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/ComponentType.xml (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/ComponentType.xml 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-some-interface>
+ <iface>ONE</iface>
+ <iface>TWO</iface>
+ <impl>THREE</impl>
+</root-some-interface>
Property changes on: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/ComponentType.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Added: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongBoth.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongBoth.xml (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongBoth.xml 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,3 @@
+<root-wrong-both xmlns="ns">
+ <key>ONE</key><value>TWO</value>
+</root-wrong-both>
\ No newline at end of file
Added: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongKey.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongKey.xml (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongKey.xml 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,3 @@
+<root-wrong-key xmlns="ns">
+ <key>ONE</key><value>TWO</value>
+</root-wrong-key>
\ No newline at end of file
Added: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongValue.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongValue.xml (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/map/test/KeyValueType_testWrongValue.xml 2008-11-27 16:03:51 UTC (rev 2951)
@@ -0,0 +1,3 @@
+<root-wrong-value xmlns="ns">
+ <key>ONE</key><value>TWO</value>
+</root-wrong-value>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list