Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 82624 invoked from network); 20 Jul 2005 14:57:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jul 2005 14:57:32 -0000 Received: (qmail 87715 invoked by uid 500); 20 Jul 2005 14:57:31 -0000 Mailing-List: contact jdo-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-dev@db.apache.org Received: (qmail 87702 invoked by uid 99); 20 Jul 2005 14:57:31 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jul 2005 07:57:31 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [212.224.30.66] (HELO service-01.spree.de) (212.224.30.66) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jul 2005 07:57:26 -0700 Received: from [172.16.1.80] (extern.spree.de [172.16.1.80]) (authenticated bits=0) by service-01.spree.de (8.13.4/8.13.4/Debian-3) with ESMTP id j6KEp8S0007398 for ; Wed, 20 Jul 2005 16:55:49 +0200 Message-ID: <42DE6537.4020106@spree.de> Date: Wed, 20 Jul 2005 16:52:39 +0200 From: Michael Bouschen Organization: Tech@Spree Engineering User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: jdo-dev@db.apache.org Subject: Patch for review: add method to return the root list to CompanyModelReader Content-Type: multipart/mixed; boundary="------------080301080309000601010704" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------080301080309000601010704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, attached you find a patch adding a new method getRootList to the CompanyModelReader. It expects to find a bean called root and having the type List in the testdata xml. The method returns the list. I changed the CompletenessTest and the query test superclass to make use of the new method. Regards Michael -- Michael Bouschen Tech@Spree Engineering GmbH mailto:mbo.tech@spree.de http://www.tech.spree.de/ Tel.:++49/30/235 520-33 Buelowstr. 66 Fax.:++49/30/2175 2012 D-10783 Berlin --------------080301080309000601010704 Content-Type: text/plain; name="mbo-050720-rootList.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mbo-050720-rootList.patch" Index: test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java =================================================================== --- test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java (revision 219905) +++ test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java (working copy) @@ -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 */ @@ -82,6 +86,15 @@ 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); + } /** * Configure the CompanyModelReader, e.g. register CustomEditor classes Index: test/java/org/apache/jdo/tck/query/QueryTest.java =================================================================== --- test/java/org/apache/jdo/tck/query/QueryTest.java (revision 219905) +++ test/java/org/apache/jdo/tck/query/QueryTest.java (working copy) @@ -130,7 +130,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(); @@ -145,6 +145,7 @@ * The method returns the CompanyModelReader instance allowing to access * a compay model instance by name. */ + /* public CompanyModelReader loadCompanyModel(PersistenceManager pm, String filename, Class pcRootClass) { @@ -161,6 +162,7 @@ tx = null; return reader; } + */ /** */ public void cleanupCompanyModel(PersistenceManager pm) { Index: test/java/org/apache/jdo/tck/query/ComparingCollectionFieldToNull.java =================================================================== --- test/java/org/apache/jdo/tck/query/ComparingCollectionFieldToNull.java (revision 219905) +++ test/java/org/apache/jdo/tck/query/ComparingCollectionFieldToNull.java (working copy) @@ -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 { Index: test/java/org/apache/jdo/tck/query/DenoteUniquenessInFilter.java =================================================================== --- test/java/org/apache/jdo/tck/query/DenoteUniquenessInFilter.java (revision 219905) +++ test/java/org/apache/jdo/tck/query/DenoteUniquenessInFilter.java (working copy) @@ -69,7 +69,7 @@ try { // read test data CompanyModelReader reader = - loadCompanyModel(pm, COMPANY_TESTDATA, Department.class); + loadCompanyModel(pm, COMPANY_TESTDATA); runTest(pm, reader); } finally { Index: test/java/org/apache/jdo/tck/mapping/CompletenessTest.java =================================================================== --- test/java/org/apache/jdo/tck/mapping/CompletenessTest.java (revision 219905) +++ test/java/org/apache/jdo/tck/mapping/CompletenessTest.java (working copy) @@ -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(); --------------080301080309000601010704--