db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject [db-jdo] branch master updated: JDO-786: spring 2.5.6.SEC03 -> 4.3.28.RELEASE
Date Sun, 06 Sep 2020 13:22:35 GMT
This is an automated email from the ASF dual-hosted git repository.

mbo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/db-jdo.git


The following commit(s) were added to refs/heads/master by this push:
     new fb87b65  JDO-786: spring 2.5.6.SEC03 -> 4.3.28.RELEASE
fb87b65 is described below

commit fb87b65c01d631844ec2dcda962a907d00bb32b6
Author: Michael Bouschen <mbo@apache.org>
AuthorDate: Sun Sep 6 15:22:26 2020 +0200

    JDO-786: spring 2.5.6.SEC03 -> 4.3.28.RELEASE
---
 parent-pom/pom.xml                                 |  4 +--
 .../org/apache/jdo/tck/AbstractReaderTest.java     | 14 ++++----
 .../apache/jdo/tck/mapping/CompletenessTest.java   |  2 --
 .../jdo/tck/mapping/CompletenessTestJPA.java       |  2 --
 .../jdo/tck/mapping/CompletenessTestList.java      |  2 --
 .../jdo/tck/mapping/CompletenessTestMap.java       |  2 --
 .../jdo/tck/pc/company/CompanyModelReader.java     | 37 +++++++--------------
 .../companyListWithoutJoin/CompanyModelReader.java | 37 +++++++--------------
 .../companyMapWithoutJoin/CompanyModelReader.java  | 37 +++++++--------------
 .../org/apache/jdo/tck/pc/mylib/MylibReader.java   | 38 +++++++---------------
 .../apache/jdo/tck/pc/order/OrderModelReader.java  | 38 +++++++---------------
 .../apache/jdo/tck/util/JDOCustomDateEditor.java   | 33 +++++++++++++++++++
 12 files changed, 102 insertions(+), 144 deletions(-)

diff --git a/parent-pom/pom.xml b/parent-pom/pom.xml
index 4c19395..b18e590 100644
--- a/parent-pom/pom.xml
+++ b/parent-pom/pom.xml
@@ -109,12 +109,12 @@ Requests (JSR 12 and 243) under the auspices of the Java Community Process.</des
       <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-core</artifactId>
-        <version>2.5.6.SEC03</version>
+        <version>4.3.28.RELEASE</version>
       </dependency>
       <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-beans</artifactId>
-        <version>2.5.6.SEC03</version>
+        <version>4.3.28.RELEASE</version>
       </dependency>
       <dependency>
         <groupId>commons-collections</groupId>
diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java
index e3ae6e5..9e030c6 100644
--- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java
+++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java
@@ -24,7 +24,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 
 /*
  * Abstract class for managed relationship tests
@@ -45,15 +45,15 @@ public class AbstractReaderTest extends JDO_Test {
 
     /** Get the named bean from the bean factory.
      * 
-     * @param reader the xml bean reader
+     * @param factory the bean factory
      * @param name the name of the bean
      * @return the named object
      */
-    protected Object getBean(final XmlBeanFactory reader, final String name) {
+    protected Object getBean(final DefaultListableBeanFactory factory, final String name)
{
         return AccessController.doPrivileged(
             new PrivilegedAction() {
                 public Object run() {
-                    return reader.getBean(name);
+                    return factory.getBean(name);
                 }
             }
         );
@@ -61,11 +61,11 @@ public class AbstractReaderTest extends JDO_Test {
 
     /** Get the root object from the bean factory.
      * 
-     * @param reader the xml bean reader
+     * @param factory the bean factory
      * @return the List of objects
      */
-    protected List getRootList(XmlBeanFactory reader) {
-        return (List) getBean(reader, rootName);
+    protected List getRootList(DefaultListableBeanFactory factory) {
+        return (List) getBean(factory, rootName);
     }
 
     /** Get the named object from the Map of objects.
diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTest.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTest.java
index 197fc2a..568d686 100644
--- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTest.java
+++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTest.java
@@ -28,8 +28,6 @@ import org.apache.jdo.tck.util.BatchTestRunner;
 import org.apache.jdo.tck.util.DeepEquality;
 import org.apache.jdo.tck.util.EqualityHelper;
 
-//import org.springframework.beans.factory.xml.XmlBeanFactory;
-
 /**
  *<B>Title:</B>Completeness Test
  *<BR>
diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestJPA.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestJPA.java
index 0919236..d089d1d 100644
--- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestJPA.java
+++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestJPA.java
@@ -28,8 +28,6 @@ import org.apache.jdo.tck.util.BatchTestRunner;
 import org.apache.jdo.tck.util.DeepEquality;
 import org.apache.jdo.tck.util.EqualityHelper;
 
-//import org.springframework.beans.factory.xml.XmlBeanFactory;
-
 /**
  *<B>Title:</B>Completeness Test JPA
  *<BR>
diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestList.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestList.java
index 5c4a857..1068d26 100644
--- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestList.java
+++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestList.java
@@ -28,8 +28,6 @@ import org.apache.jdo.tck.util.BatchTestRunner;
 import org.apache.jdo.tck.util.DeepEquality;
 import org.apache.jdo.tck.util.EqualityHelper;
 
-//import org.springframework.beans.factory.xml.XmlBeanFactory;
-
 /**
  *<B>Title:</B>Completeness Test List
  *<BR>
diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java
index e2cfe7c..d39afc8 100644
--- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java
+++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java
@@ -28,8 +28,6 @@ import org.apache.jdo.tck.util.BatchTestRunner;
 import org.apache.jdo.tck.util.DeepEquality;
 import org.apache.jdo.tck.util.EqualityHelper;
 
-//import org.springframework.beans.factory.xml.XmlBeanFactory;
-
 /**
  *<B>Title:</B>Completeness Test Map
  *<BR>
diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
index b2d489a..0bd5737 100644
--- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
+++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
@@ -17,18 +17,15 @@
  
 package org.apache.jdo.tck.pc.company;
 
-import java.io.InputStream;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Locale;
-import java.util.TimeZone;
 
 import org.apache.jdo.tck.util.ConversionHelper;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.beans.propertyeditors.CustomDateEditor;
+import org.apache.jdo.tck.util.JDOCustomDateEditor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.InputStreamResource;
 
 /**
  * Utility class to create a graph of company model instances from an xml
@@ -36,10 +33,7 @@ import org.springframework.core.io.InputStreamResource;
  *
  * @author Michael Bouschen
  */
-public class CompanyModelReader extends XmlBeanFactory {
-
-    /** The format of date values in the xml representation */
-    public static final String DATE_PATTERN = "d/MMM/yyyy";
+public class CompanyModelReader extends DefaultListableBeanFactory {
 
     /** The name of the root list bean. */
     public static final String ROOT_LIST_NAME = "root";
@@ -51,6 +45,9 @@ public class CompanyModelReader extends XmlBeanFactory {
     /** The company factory instance. */
     private CompanyFactory companyFactory;
 
+    /** Bean definition reader  */
+    private final XmlBeanDefinitionReader reader;
+
     /** 
      * Create a CompanyModelReader for the specified resourceName. 
      * @param resourceName the name of the resource
@@ -66,17 +63,10 @@ public class CompanyModelReader extends XmlBeanFactory {
      * @param classLoader the ClassLoader for the lookup
      */
     public CompanyModelReader(String resourceName, ClassLoader classLoader) {
-        super(new ClassPathResource(resourceName, classLoader));
-        configureFactory();
-    }
-
-    /**
-     * Create a CompanyModelReader for the specified InputStream.
-     * @param stream the input stream
-     */
-    public CompanyModelReader(InputStream stream) {
-        super(new InputStreamResource(stream));
+        super();
         configureFactory();
+        this.reader = new XmlBeanDefinitionReader(this);
+        this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader));
     }
 
     /** 
@@ -94,10 +84,7 @@ public class CompanyModelReader extends XmlBeanFactory {
      * of the right type.
      */
     private void configureFactory() {
-        SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN, Locale.US);
-        CustomDateEditor dateEditor =
-            new CustomDateEditor(formatter, true);
-        registerCustomEditor(Date.class, dateEditor);
+        registerCustomEditor(Date.class, JDOCustomDateEditor.class);
         companyFactory = CompanyFactoryRegistry.getInstance();
         addSingleton(BEAN_FACTORY_NAME, companyFactory);
     }
@@ -117,7 +104,7 @@ public class CompanyModelReader extends XmlBeanFactory {
     }
 
     public static Date stringToUtilDate(String value) {
-        return ConversionHelper.toUtilDate(DATE_PATTERN, Locale.US, value);
+        return ConversionHelper.toUtilDate(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value);
     }
     
     // Convenience methods
diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java
b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java
index a82546b..25301c7 100644
--- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java
+++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java
@@ -17,18 +17,15 @@
  
 package org.apache.jdo.tck.pc.companyListWithoutJoin;
 
-import java.io.InputStream;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Locale;
-import java.util.TimeZone;
 
 import org.apache.jdo.tck.util.ConversionHelper;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.beans.propertyeditors.CustomDateEditor;
+import org.apache.jdo.tck.util.JDOCustomDateEditor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.InputStreamResource;
 
 /**
  * Utility class to create a graph of company model instances from an xml
@@ -36,10 +33,7 @@ import org.springframework.core.io.InputStreamResource;
  *
  * @author Michael Bouschen
  */
-public class CompanyModelReader extends XmlBeanFactory {
-
-    /** The format of date values in the xml representation */
-    public static final String DATE_PATTERN = "d/MMM/yyyy";
+public class CompanyModelReader extends DefaultListableBeanFactory {
 
     /** The name of the root list bean. */
     public static final String ROOT_LIST_NAME = "root";
@@ -51,6 +45,9 @@ public class CompanyModelReader extends XmlBeanFactory {
     /** The company factory instance. */
     private CompanyFactory companyFactory;
 
+    /** Bean definition reader  */
+    private final XmlBeanDefinitionReader reader;
+
     /** 
      * Create a CompanyModelReader for the specified resourceName. 
      * @param resourceName the name of the resource
@@ -66,17 +63,10 @@ public class CompanyModelReader extends XmlBeanFactory {
      * @param classLoader the ClassLoader for the lookup
      */
     public CompanyModelReader(String resourceName, ClassLoader classLoader) {
-        super(new ClassPathResource(resourceName, classLoader));
-        configureFactory();
-    }
-
-    /**
-     * Create a CompanyModelReader for the specified InputStream.
-     * @param stream the input stream
-     */
-    public CompanyModelReader(InputStream stream) {
-        super(new InputStreamResource(stream));
+        super();
         configureFactory();
+        this.reader = new XmlBeanDefinitionReader(this);
+        this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader));
     }
 
     /** 
@@ -94,10 +84,7 @@ public class CompanyModelReader extends XmlBeanFactory {
      * of the right type.
      */
     private void configureFactory() {
-        SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN, Locale.US);
-        CustomDateEditor dateEditor =
-            new CustomDateEditor(formatter, true);
-        registerCustomEditor(Date.class, dateEditor);
+        registerCustomEditor(Date.class, JDOCustomDateEditor.class);
         companyFactory = CompanyFactoryRegistry.getInstance();
         addSingleton(BEAN_FACTORY_NAME, companyFactory);
     }
@@ -191,7 +178,7 @@ public class CompanyModelReader extends XmlBeanFactory {
     }
 
     public static Date stringToUtilDate(String value) {
-        return ConversionHelper.toUtilDate(DATE_PATTERN, Locale.US, value);
+        return ConversionHelper.toUtilDate(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value);
     }
 }
 
diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java
b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java
index 22f01c7..b63d85a 100644
--- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java
+++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java
@@ -17,18 +17,15 @@
  
 package org.apache.jdo.tck.pc.companyMapWithoutJoin;
 
-import java.io.InputStream;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Locale;
-import java.util.TimeZone;
 
 import org.apache.jdo.tck.util.ConversionHelper;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.beans.propertyeditors.CustomDateEditor;
+import org.apache.jdo.tck.util.JDOCustomDateEditor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.InputStreamResource;
 
 /**
  * Utility class to create a graph of company model instances from an xml
@@ -36,10 +33,7 @@ import org.springframework.core.io.InputStreamResource;
  *
  * @author Michael Bouschen
  */
-public class CompanyModelReader extends XmlBeanFactory {
-
-    /** The format of date values in the xml representation */
-    public static final String DATE_PATTERN = "d/MMM/yyyy";
+public class CompanyModelReader extends DefaultListableBeanFactory {
 
     /** The name of the root list bean. */
     public static final String ROOT_LIST_NAME = "root";
@@ -51,6 +45,9 @@ public class CompanyModelReader extends XmlBeanFactory {
     /** The company factory instance. */
     private CompanyFactory companyFactory;
 
+    /** Bean definition reader  */
+    private final XmlBeanDefinitionReader reader;
+
     /** 
      * Create a CompanyModelReader for the specified resourceName. 
      * @param resourceName the name of the resource
@@ -66,17 +63,10 @@ public class CompanyModelReader extends XmlBeanFactory {
      * @param classLoader the ClassLoader for the lookup
      */
     public CompanyModelReader(String resourceName, ClassLoader classLoader) {
-        super(new ClassPathResource(resourceName, classLoader));
-        configureFactory();
-    }
-
-    /**
-     * Create a CompanyModelReader for the specified InputStream.
-     * @param stream the input stream
-     */
-    public CompanyModelReader(InputStream stream) {
-        super(new InputStreamResource(stream));
+        super();
         configureFactory();
+        this.reader = new XmlBeanDefinitionReader(this);
+        this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader));
     }
 
     /** 
@@ -94,10 +84,7 @@ public class CompanyModelReader extends XmlBeanFactory {
      * of the right type.
      */
     private void configureFactory() {
-        SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN, Locale.US);
-        CustomDateEditor dateEditor =
-            new CustomDateEditor(formatter, true);
-        registerCustomEditor(Date.class, dateEditor);
+        registerCustomEditor(Date.class, JDOCustomDateEditor.class);
         companyFactory = CompanyFactoryRegistry.getInstance();
         addSingleton(BEAN_FACTORY_NAME, companyFactory);
     }
@@ -191,7 +178,7 @@ public class CompanyModelReader extends XmlBeanFactory {
     }
 
     public static Date stringToUtilDate(String value) {
-        return ConversionHelper.toUtilDate(DATE_PATTERN, Locale.US, value);
+        return ConversionHelper.toUtilDate(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value);
     }
 }
 
diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java
index e345082..9648493 100644
--- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java
+++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java
@@ -17,26 +17,19 @@
  
 package org.apache.jdo.tck.pc.mylib;
 
-import java.io.InputStream;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
-import java.util.Locale;
-import java.util.TimeZone;
 
-import org.springframework.beans.propertyeditors.CustomDateEditor;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.apache.jdo.tck.util.JDOCustomDateEditor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.InputStreamResource;
 
 /**
  * Utility class to create a mylib instances from an xml
  * representation. 
  */
-public class MylibReader extends XmlBeanFactory {
-
-    /** The format of date values in the xml representation */
-    public static final String DATE_PATTERN = "d/MMM/yyyy";
+public class MylibReader extends DefaultListableBeanFactory {
 
     /** The name of the root list bean. */
     public static final String ROOT_LIST_NAME = "root";
@@ -46,7 +39,10 @@ public class MylibReader extends XmlBeanFactory {
     private static final Class[] tearDownClasses = new Class[] {
         PrimitiveTypes.class, PCClass.class
     };
-    
+
+    /** Bean definition reader  */
+    private final XmlBeanDefinitionReader reader;
+
     /** 
      * Create a MylibReader for the specified resourceName. 
      * @param resourceName the name of the resource
@@ -62,17 +58,10 @@ public class MylibReader extends XmlBeanFactory {
      * @param classLoader the ClassLoader for the lookup
      */
     public MylibReader(String resourceName, ClassLoader classLoader) {
-        super(new ClassPathResource(resourceName, classLoader));
-        configureFactory();
-    }
-
-    /**
-     * Create a MylibReader for the specified InputStream.
-     * @param stream the input stream
-     */
-    public MylibReader(InputStream stream) {
-        super(new InputStreamResource(stream));
+        super();
         configureFactory();
+        this.reader = new XmlBeanDefinitionReader(this);
+        this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader));
     }
 
     /** 
@@ -90,10 +79,7 @@ public class MylibReader extends XmlBeanFactory {
      * of the right type.
      */
     private void configureFactory() {
-        SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN, Locale.US);
-        CustomDateEditor dateEditor =
-            new CustomDateEditor(formatter, true);
-        registerCustomEditor(Date.class, dateEditor);
+        registerCustomEditor(Date.class, JDOCustomDateEditor.class);
     }
     
     // Convenience methods
diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java
index 4f655fd..6e12520 100644
--- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java
+++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java
@@ -17,28 +17,22 @@
  
 package org.apache.jdo.tck.pc.order;
 
-import java.io.InputStream;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Locale;
-import java.util.TimeZone;
 
 import org.apache.jdo.tck.util.ConversionHelper;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.beans.propertyeditors.CustomDateEditor;
+import org.apache.jdo.tck.util.JDOCustomDateEditor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.InputStreamResource;
 
 /**
  * Utility class to create a graph of order model instances from an xml
  * representation. 
  *
  */
-public class OrderModelReader extends XmlBeanFactory {
-
-    /** The format of date values in the xml representation */
-    public static final String DATE_PATTERN = "d/MMM/yyyy";
+public class OrderModelReader extends DefaultListableBeanFactory {
 
     /** The name of the root list bean. */
     public static final String ROOT_LIST_NAME = "root";
@@ -50,6 +44,9 @@ public class OrderModelReader extends XmlBeanFactory {
     /** The order factory instance. */
     private OrderFactory orderFactory;
 
+    /** Bean definition reader  */
+    private final XmlBeanDefinitionReader reader;
+
     /** 
      * Create a OrderModelReader for the specified resourceName. 
      * @param resourceName the name of the resource
@@ -65,17 +62,10 @@ public class OrderModelReader extends XmlBeanFactory {
      * @param classLoader the ClassLOader for the lookup
      */
     public OrderModelReader(String resourceName, ClassLoader classLoader) {
-        super(new ClassPathResource(resourceName, classLoader));
-        configureFactory();
-    }
-
-    /**
-     * Create a OrderModelReader for the specified InputStream.
-     * @param stream the input stream
-     */
-    public OrderModelReader(InputStream stream) {
-        super(new InputStreamResource(stream));
+        super();
         configureFactory();
+        this.reader = new XmlBeanDefinitionReader(this);
+        this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader));
     }
 
     /** 
@@ -93,11 +83,7 @@ public class OrderModelReader extends XmlBeanFactory {
      * of the right type.
      */
     private void configureFactory() {
-        SimpleDateFormat formatter =
-            new SimpleDateFormat(DATE_PATTERN, Locale.US);
-        CustomDateEditor dateEditor =
-            new CustomDateEditor(formatter, true);
-        registerCustomEditor(Date.class, dateEditor);
+        registerCustomEditor(Date.class, JDOCustomDateEditor.class);
         orderFactory = OrderFactoryRegistry.getInstance();
         addSingleton(BEAN_FACTORY_NAME, orderFactory);
     }
@@ -143,7 +129,7 @@ public class OrderModelReader extends XmlBeanFactory {
     }
 
     public static Date stringToUtilDate(String value) {
-        return ConversionHelper.toUtilDate(DATE_PATTERN, Locale.US, value);
+        return ConversionHelper.toUtilDate(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value);
     }
 }
 
diff --git a/tck/src/main/java/org/apache/jdo/tck/util/JDOCustomDateEditor.java b/tck/src/main/java/org/apache/jdo/tck/util/JDOCustomDateEditor.java
new file mode 100644
index 0000000..7546252
--- /dev/null
+++ b/tck/src/main/java/org/apache/jdo/tck/util/JDOCustomDateEditor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.jdo.tck.util;
+
+import org.springframework.beans.propertyeditors.CustomDateEditor;
+
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
+public class JDOCustomDateEditor extends CustomDateEditor {
+
+    /** The format of date values in the xml representation */
+    public static final String DATE_PATTERN = "d/MMM/yyyy";
+
+    public JDOCustomDateEditor() {
+        super(new SimpleDateFormat(DATE_PATTERN, Locale.US), true);
+    }
+}


Mime
View raw message