xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z...@apache.org
Subject cvs commit: xml-xmlbeans/v2/test/src/drt/drtcases BindingTests.java
Date Mon, 13 Oct 2003 22:26:50 GMT
zieg        2003/10/13 15:26:50

  Modified:    v2/src/binding/org/apache/xmlbeans/impl/binding/bts
                        BuiltinBindingLoader.java BaseBindingLoader.java
               v2/test/src/drt/drtcases BindingTests.java
  Log:
  Fix BindingTests to deal with package rename
  Fix builtin loading and add small test for it
  
  Revision  Changes    Path
  1.2       +0 -5      xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BuiltinBindingLoader.java
  
  Index: BuiltinBindingLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BuiltinBindingLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BuiltinBindingLoader.java	10 Oct 2003 20:09:27 -0000	1.1
  +++ BuiltinBindingLoader.java	13 Oct 2003 22:26:50 -0000	1.2
  @@ -66,11 +66,6 @@
    */ 
   public class BuiltinBindingLoader extends BaseBindingLoader
   {
  -    private Map bindingTypes = new LinkedHashMap();    // name-pair -> BindingType
  -    private Map xmlFromJava = new LinkedHashMap();     // javaName -> xmlName
  -    private Map javaFromXmlPojo = new LinkedHashMap(); // xmlName -> javaName (pojo)
  -    private Map javaFromXmlObj = new LinkedHashMap();  // xmlName -> javaName (xmlobj)
  -    
       private static final String xsns = "http://www.w3.org/2001/XMLSchema";
       
       private void addMapping(String xmlType, String javaName, boolean pojo, boolean defaultForJava,
boolean defaultForXml)
  
  
  
  1.2       +4 -4      xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BaseBindingLoader.java
  
  Index: BaseBindingLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BaseBindingLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseBindingLoader.java	10 Oct 2003 20:09:27 -0000	1.1
  +++ BaseBindingLoader.java	13 Oct 2003 22:26:50 -0000	1.2
  @@ -64,10 +64,10 @@
    */ 
   public abstract class BaseBindingLoader implements BindingLoader
   {
  -    protected Map bindingTypes = new LinkedHashMap();    // name-pair -> BindingType
  -    protected Map xmlFromJava = new LinkedHashMap();     // javaName -> pair
  -    protected Map javaFromXmlPojo = new LinkedHashMap(); // xmlName -> pair (pojo)
  -    protected Map javaFromXmlObj = new LinkedHashMap();  // xmlName -> pair (xmlobj)
  +    protected final Map bindingTypes = new LinkedHashMap();    // name-pair -> BindingType
  +    protected final Map xmlFromJava = new LinkedHashMap();     // javaName -> pair
  +    protected final Map javaFromXmlPojo = new LinkedHashMap(); // xmlName -> pair (pojo)
  +    protected final Map javaFromXmlObj = new LinkedHashMap();  // xmlName -> pair (xmlobj)
   
       public BindingType getBindingType(JavaName jName, XmlName xName)
       {
  
  
  
  1.3       +22 -12    xml-xmlbeans/v2/test/src/drt/drtcases/BindingTests.java
  
  Index: BindingTests.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/src/drt/drtcases/BindingTests.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BindingTests.java	7 Oct 2003 20:29:22 -0000	1.2
  +++ BindingTests.java	13 Oct 2003 22:26:50 -0000	1.3
  @@ -5,19 +5,20 @@
    */
   package drtcases;
   
  -import junit.framework.TestCase;
  +import junit.framework.Assert;
   import junit.framework.Test;
  +import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -import junit.framework.Assert;
  -import org.apache.xmlbeans.impl.binding.BindingFile;
  -import org.apache.xmlbeans.impl.binding.ByNameBean;
  -import org.apache.xmlbeans.impl.binding.JavaName;
  -import org.apache.xmlbeans.impl.binding.XmlName;
  -import org.apache.xmlbeans.impl.binding.QNameProperty;
  -import org.apache.xmlbeans.impl.binding.PathBindingLoader;
  -import org.apache.xmlbeans.impl.binding.BuiltinBindingLoader;
  -import org.apache.xmlbeans.impl.binding.BindingLoader;
  -import org.apache.xmlbeans.impl.binding.SimpleBindingType;
  +import org.apache.xmlbeans.impl.binding.bts.BindingFile;
  +import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
  +import org.apache.xmlbeans.impl.binding.bts.BindingType;
  +import org.apache.xmlbeans.impl.binding.bts.BuiltinBindingLoader;
  +import org.apache.xmlbeans.impl.binding.bts.ByNameBean;
  +import org.apache.xmlbeans.impl.binding.bts.JavaName;
  +import org.apache.xmlbeans.impl.binding.bts.PathBindingLoader;
  +import org.apache.xmlbeans.impl.binding.bts.QNameProperty;
  +import org.apache.xmlbeans.impl.binding.bts.SimpleBindingType;
  +import org.apache.xmlbeans.impl.binding.bts.XmlName;
   import org.apache.xmlbeans.x2003.x09.bindingConfig.BindingConfigDocument;
   
   import javax.xml.namespace.QName;
  @@ -95,7 +96,16 @@
           ByNameBean bnbc = (ByNameBean)bfc.getBindingType(JavaName.forString("com.mytest.MyClass"),
XmlName.forString("t=my-type@http://www.mytest.com/"));
           ByNameBean bnb2c = (ByNameBean)bfc.getBindingType(JavaName.forString("com.mytest.YourClass"),
XmlName.forString("t=your-type@http://www.mytest.com/"));
           SimpleBindingType sbtc = (SimpleBindingType)bfc.getBindingType(JavaName.forString("java.lang.String"),
XmlName.forString("t=custom-string@http://www.mytest.com/"));
  -        
  +
  +        // check loading xsd:float
  +        QName qn = new QName("http://www.w3.org/2001/XMLSchema", "float");
  +        XmlName xn = XmlName.forTypeNamed(qn);
  +        XmlName xns = XmlName.forString("t=float@http://www.w3.org/2001/XMLSchema");
  +        Assert.assertEquals(xn, xns);
  +        Assert.assertEquals(xn.hashCode(), xns.hashCode());
  +        BindingType btype = lc.getBindingTypeForXmlPojo(xn);
  +        Assert.assertNotNull(btype);
  +
           // check bnb
           prop = bnbc.getPropertyForElement(new QName("http://www.mytest.com/", "myelt"));
           Assert.assertEquals("setMyelt", prop.getSetterName());
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message