db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r220048 - in /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck: mapping/CompletenessTest.java pc/company/CompanyModelReader.java query/ComparingCollectionFieldToNull.java query/DenoteUniquenessInFilter.java query/QueryTest.java
Date Thu, 21 Jul 2005 12:33:52 GMT
Author: mbo
Date: Thu Jul 21 05:33:51 2005
New Revision: 220048

URL: http://svn.apache.org/viewcvs?rev=220048&view=rev
Log:
Add method getRootList to CompanyModelReader returning a list of root objects specified in
the testdata xml

Modified:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ComparingCollectionFieldToNull.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/DenoteUniquenessInFilter.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java?rev=220048&r1=220047&r2=220048&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java Thu
Jul 21 05:33:51 2005
@@ -46,9 +46,6 @@
         "Assertion A18-[not identified] failed: ";
     
     /** */
-    public static final String ROOT_NAME = "root";
-    
-    /** */
     protected List rootOids;
     
         // todo: get filename from property
@@ -71,7 +68,7 @@
         // persist test data
         getPM();
         pm.currentTransaction().begin();
-        List rootList = (List)reader.getBean(ROOT_NAME);
+        List rootList = reader.getRootList();
         pm.makePersistentAll(rootList);
         addTearDownClass(reader.getTearDownClasses());
         rootOids = new ArrayList();
@@ -88,7 +85,7 @@
         
         // get new obj graph
         CompanyModelReader reader = new CompanyModelReader(inputFilename);
-        List rootList = (List)reader.getBean(ROOT_NAME);
+        List rootList = reader.getRootList();
         
         getPM();
         pm.currentTransaction().begin();

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java?rev=220048&r1=220047&r2=220048&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
Thu Jul 21 05:33:51 2005
@@ -19,6 +19,7 @@
 import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.List;
 import java.util.Locale;
 import java.util.TimeZone;
 
@@ -37,6 +38,9 @@
 
     /** The format of date values in the xml representation */
     public static final String DATE_PATTERN = "d/MMM/yyyy";
+
+    /** The name of the root list bean. */
+    public static final String ROOT_LIST_NAME = "root";
     
     /** All classes in the model 
      */
@@ -81,6 +85,15 @@
     public CompanyModelReader(InputStream stream) {
         super(new InputStreamResource(stream));
         configureFactory();
+    }
+
+    /** 
+     * Returns a list of root objects. The method expects to find a bean
+     * called "root" of type list in the xml and returns it.
+     * @return a list of root instances
+     */
+    public List getRootList() {
+        return (List)getBean(ROOT_LIST_NAME);
     }
     
     /** 

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ComparingCollectionFieldToNull.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ComparingCollectionFieldToNull.java?rev=220048&r1=220047&r2=220048&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ComparingCollectionFieldToNull.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ComparingCollectionFieldToNull.java
Thu Jul 21 05:33:51 2005
@@ -63,8 +63,7 @@
         
         try {
             // read test data
-            CompanyModelReader reader = loadCompanyModel(
-                pm, "org/apache/jdo/tck/pc/company/companyForQueryTests.xml");
+            CompanyModelReader reader = loadCompanyModel(pm, COMPANY_TESTDATA);
             runTest(pm, reader);
         }
         finally {

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/DenoteUniquenessInFilter.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/DenoteUniquenessInFilter.java?rev=220048&r1=220047&r2=220048&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/DenoteUniquenessInFilter.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/DenoteUniquenessInFilter.java
Thu Jul 21 05:33:51 2005
@@ -69,7 +69,7 @@
         try {
             // read test data
             CompanyModelReader reader = 
-                loadCompanyModel(pm, COMPANY_TESTDATA, Department.class);
+                loadCompanyModel(pm, COMPANY_TESTDATA);
             runTest(pm, reader);
         }
         finally {

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java?rev=220048&r1=220047&r2=220048&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java Thu Jul 21
05:33:51 2005
@@ -50,9 +50,6 @@
     public static final String COMPANY_TESTDATA = 
         "org/apache/jdo/tck/pc/company/companyForQueryTests.xml";
 
-    /** */
-    public static final String ROOT_NAME = "root";
-    
     /** 
      * List of inserted instances (see methods insertPCPoints and
      * getFromInserted). 
@@ -130,7 +127,7 @@
         CompanyModelReader reader = new CompanyModelReader(filename);
         Transaction tx = pm.currentTransaction();
         tx.begin();
-        List rootList = (List)reader.getBean(ROOT_NAME);
+        List rootList = (List)reader.getRootList();
         pm.makePersistentAll(rootList);
         if (debug) logger.debug("inserted " + rootList);
         tx.commit();
@@ -138,30 +135,6 @@
         return reader;
     }
     
-    /** 
-     * Reads a graph of company model objects from the specified xml file. This 
-     * methods calls makePersistent for all instances of the specified 
-     * pcRootClass which then runs the reachability algorithm. 
-     * The method returns the CompanyModelReader instance allowing to access 
-     * a compay model instance by name.
-     */
-    public CompanyModelReader loadCompanyModel(PersistenceManager pm,            
-                                               String filename,
-                                               Class pcRootClass) {
-        CompanyModelReader reader = new CompanyModelReader(filename);
-        Transaction tx = pm.currentTransaction();
-        tx.begin();
-        Map rootBeans = reader.getBeansOfType(pcRootClass);
-        for (Iterator i = rootBeans.values().iterator(); i.hasNext();) {
-            Object bean = i.next();
-            pm.makePersistent(bean);
-            if (debug) logger.debug("inserted " + bean);
-        }
-        tx.commit();
-        tx = null;
-        return reader;
-    }
-
     /** */
     public void cleanupCompanyModel(PersistenceManager pm) {
         Transaction tx = pm.currentTransaction();



Mime
View raw message