[jboss-svn-commits] JBoss Common SVN: r2899 - in jbossxb/trunk/src/test: java/org/jboss/test/xml/repeatableterms and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Aug 14 08:58:39 EDT 2008


Author: alex.loubyansky at jboss.com
Date: 2008-08-14 08:58:39 -0400 (Thu, 14 Aug 2008)
New Revision: 2899

Added:
   jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/
   jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java
   jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/Product.java
   jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/ProductArray.java
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xml
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xsd
Modified:
   jbossxb/trunk/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java
Log:
JBXB-116 testcase

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java	2008-08-11 18:23:09 UTC (rev 2898)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java	2008-08-14 12:58:39 UTC (rev 2899)
@@ -22,7 +22,11 @@
 package org.jboss.test.xml;
 
 import java.util.Arrays;
+import java.util.List;
 
+import org.jboss.test.xml.repeatableterms.AbstractProduct;
+import org.jboss.test.xml.repeatableterms.ProductArray;
+
 import junit.framework.TestSuite;
 
 /**
@@ -103,6 +107,17 @@
       assertEquals("item2", top.item2);
    }
 
+   public void testPolymorphicArray() throws Exception
+   {
+      Object o = unmarshal();
+      assertNotNull(o);
+      assertTrue(o instanceof ProductArray);
+      ProductArray arr = (ProductArray) o;
+      List<AbstractProduct> products = arr.getProduct();
+      assertNotNull(products);
+      assertEquals(3, products.size());
+   }
+   
    // Inner
 
    public static final class Top

Added: jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java	2008-08-14 12:58:39 UTC (rev 2899)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.xml.repeatableterms;
+
+/**
+ * A BasicProduct.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractProduct
+{
+   private String name;
+   
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/Product.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/Product.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/Product.java	2008-08-14 12:58:39 UTC (rev 2899)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.xml.repeatableterms;
+
+/**
+ * A Product.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class Product extends AbstractProduct
+{
+   private int price;
+   
+   public int getPrice()
+   {
+      return price;
+   }
+   
+   public void setPrice(int price)
+   {
+      this.price = price;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/ProductArray.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/ProductArray.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/ProductArray.java	2008-08-14 12:58:39 UTC (rev 2899)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.xml.repeatableterms;
+
+import java.util.List;
+
+/**
+ * A ProductArray.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProductArray
+{
+   private List<AbstractProduct> product;
+   
+   public List<AbstractProduct> getProduct()
+   {
+      return product;
+   }
+   
+   public void setProduct(List<AbstractProduct> products)
+   {
+      this.product = products;
+   }
+}

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xml	2008-08-14 12:58:39 UTC (rev 2899)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<product-array xmlns='http://www.jboss.org/test/xml/repeatableterms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+  <product xsi:type='Product'>
+    <name>product1</name>
+    <price>1</price>
+  </product>
+  <product xsi:type='Product'>
+    <name>product2</name>
+    <price>2</price>
+  </product>
+  <product xsi:type='Product'>
+    <name>product3</name>
+    <price>3</price>
+  </product>
+</product-array>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xsd
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xsd	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xsd	2008-08-14 12:58:39 UTC (rev 2899)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+   targetNamespace="http://www.jboss.org/test/xml/repeatableterms"
+   xmlns="http://www.jboss.org/test/xml/repeatableterms"
+   xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
+   elementFormDefault="qualified"
+   attributeFormDefault="unqualified"
+   version="1.0">
+
+   <xsd:element name="product-array">
+      <xsd:annotation>
+         <xsd:appinfo>
+            <jbxb:class impl="org.jboss.test.xml.repeatableterms.ProductArray"/>
+         </xsd:appinfo>
+      </xsd:annotation>
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element name="product" type="AbstractProduct" maxOccurs="unbounded"/>
+         </xsd:sequence>
+      </xsd:complexType>
+   </xsd:element>
+   <xsd:complexType name='AbstractProduct'>
+     <xsd:annotation>
+       <xsd:appinfo>
+          <jbxb:class impl="org.jboss.test.xml.repeatableterms.AbstractProduct"/>
+       </xsd:appinfo>
+     </xsd:annotation>
+     <xsd:sequence>
+        <xsd:element name='name' nillable='true' type='xsd:string'/>
+     </xsd:sequence>
+   </xsd:complexType>
+   <xsd:complexType name='Product'>
+    <xsd:annotation>
+       <xsd:appinfo>
+          <jbxb:class impl="org.jboss.test.xml.repeatableterms.Product"/>
+       </xsd:appinfo>
+    </xsd:annotation>
+    <xsd:complexContent>
+     <xsd:extension base='AbstractProduct'>
+      <xsd:sequence>
+       <xsd:element name='price' type='xsd:int'/>
+      </xsd:sequence>
+     </xsd:extension>
+    </xsd:complexContent>
+   </xsd:complexType>
+</xsd:schema>




More information about the jboss-svn-commits mailing list