Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 77391 invoked from network); 4 Apr 2005 20:10:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Apr 2005 20:10:33 -0000 Received: (qmail 21256 invoked by uid 500); 4 Apr 2005 20:10:33 -0000 Mailing-List: contact jdo-commits-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-commits@db.apache.org Received: (qmail 21200 invoked by uid 99); 4 Apr 2005 20:10:32 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 04 Apr 2005 13:10:29 -0700 Received: (qmail 67529 invoked by uid 65534); 4 Apr 2005 19:43:47 -0000 Message-ID: <20050404194347.67528.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Mon, 04 Apr 2005 19:43:47 -0000 Subject: svn commit: r160090 [12/63] - in incubator/jdo/trunk: ./ tck20/ tck20/assertions/ tck20/iut_jars/ tck20/test/ tck20/test/conf/ tck20/test/java/ tck20/test/java/org/ tck20/test/java/org/apache/ tck20/test/java/org/apache/jdo/ tck20/test/java/org/apache/jdo/tck/ tck20/test/java/org/apache/jdo/tck/api/ tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/api/jdohelper/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/ tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/ tck20/test/java/org/apache/jdo/tck/enhancement/ tck20/test/java/org/apache/jdo/tck/extents/ tck20/test/java/org/apache/jdo/tck/lifecycle/ tck20/test/java/org/apache/jdo/tck/lifecycle/nontransactional/ tck20/test/java/org/apache/jdo/tck/models/ tck20/test/java/org/apache/jdo/tck/models/embedded/ tck20/test/java/org/apache/jdo/tck/models/fieldtypes/ tck20/test/java/org/apache/jdo/tck/models/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/ tck20/test/java/org/apache/jdo/tck/pc/company/ tck20/test/java/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/java/org/apache/jdo/tck/pc/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/pc/lifecycle/ tck20/test/java/org/apache/jdo/tck/pc/mylib/ tck20/test/java/org/apache/jdo/tck/query/ tck20/test/java/org/apache/jdo/tck/query/operators/ tck20/test/java/org/apache/jdo/tck/transactions/ tck20/test/java/org/apache/jdo/tck/util/ tck20/test/jdo/ tck20/test/jdo/applicationidentity/ tck20/test/jdo/applicationidentity/org/ tck20/test/jdo/applicationidentity/org/apache/ tck20/test/jdo/applicationidentity/org/apache/jdo/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/jdo/datastoreidentity/ tck20/test/jdo/datastoreidentity/org/ tck20/test/jdo/datastoreidentity/org/apache/ tck20/test/jdo/datastoreidentity/org/apache/jdo/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/ tck20/test/orm/applicationidentity/ tck20/test/orm/applicationidentity/org/ tck20/test/orm/applicationidentity/org/apache/ tck20/test/orm/applicationidentity/org/apache/jdo/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/datastoreidentity/ tck20/test/orm/datastoreidentity/org/ tck20/test/orm/datastoreidentity/org/apache/ tck20/test/orm/datastoreidentity/org/apache/jdo/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/sql/ tck20/test/sql/derby/ To: jdo-commits@db.apache.org From: mcaisse@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persisten= cemanagerfactory/SetConnectionUserName.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/api/persistencemanagerfactory/SetConnectionUserName.java?vie= w=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetConnectionUserName.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetConnectionUserName.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,94 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ +=20 +package org.apache.jdo.tck.api.persistencemanagerfactory; + +import java.util.Properties; + +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + + +/** + *Title:Set ConnectionUserName of PersistenceManagerFactory + *
+ *Keywords: persistencemanagerfactory + *
+ *Assertion IDs: A11.1-13,A11.1-14. + *
+ *Assertion Description: +PersistenceManagerFactory.setConnectionUserName(String name) sets the +value of the ConnectionUserName property (the name of the user establishin= g the connection).=20 + */ + +public class SetConnectionUserName extends JDO_Test { + =20 + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertions A11.1-13,A11.1-14 (SetConnectionUserName) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(SetConnectionUserName.class); + } + + private PersistenceManagerFactory pmf; + private PersistenceManager pm; + private String pmfClass; + private String url; + private String username; + private String password; + + private static String PMFCLASS =3D "javax.jdo.PersistenceManagerFa= ctoryClass"; + private static String URL =3D "javax.jdo.option.ConnectionURL= "; + private static String USERNAME =3D "javax.jdo.option.ConnectionUse= rName"; + private static String PASSWORD =3D "javax.jdo.option.ConnectionPas= sword"; + + + /** set ConnectionUserName value and get ConnectionUserName value to v= erify */=20 + public void test() { + Properties props =3D loadProperties(PMFProperties); + pmfClass =3D props.getProperty(PMFCLASS); =20 + url =3D props.getProperty(URL); + username =3D props.getProperty(USERNAME); =20 + password =3D props.getProperty(PASSWORD); =20 + + try { + Class cl =3D Class.forName(pmfClass); + pmf =3D (PersistenceManagerFactory) cl.newInstance(); + pmf.setConnectionUserName(username); + if (!username.equals(pmf.getConnectionUserName())) { + fail(ASSERTION_FAILED, + "ConnectionUserName " + username +=20 + " not equal to value returned by PMF " + + pmf.getConnectionUserName()); + } + }=20 + catch (Exception ex) { + fail(ASSERTION_FAILED, + "Failed in setting ConnectionUserName " + ex); + } + if (debug) + logger.debug("ConnectionUserName: " + pmf.getConnectionUserNam= e());=20 + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/pers= istencemanagerfactory/SetConnectionUserName.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persisten= cemanagerfactory/SetIgnoreCache.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/api/persistencemanagerfactory/SetIgnoreCache.java?view=3Daut= o&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetIgnoreCache.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetIgnoreCache.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,103 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ +=20 +package org.apache.jdo.tck.api.persistencemanagerfactory; + +import java.util.Properties; + +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title:Set IgnoreCache of persistencemanagerfactory =20 + *
+ *Keywords: persistencemanagerfactory + *
+ *Assertion IDs: A11.1-5. + *
+ *Assertion Description: +PersistenceManagerFactory.setIgnoreCache(boolean flag) sets the value of t= he IgnoreCache property (the query mode that specifies whether cached insta= nces are considered when evaluating the filter expression).=20 + */ + +/*=20 + * Revision History + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Author : Linga Neerathilingam + * Date : 10/15/01 + * Version : 1.0 + * + */ + +public class SetIgnoreCache extends JDO_Test { + =20 + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A11.1-5 (SetIgnoreCache) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(SetIgnoreCache.class); + } + + private PersistenceManagerFactory pmf; + private PersistenceManager pm; + private String pmfClass; + private String url; + private String username; + private String password; + + private static String PMFCLASS =3D "javax.jdo.PersistenceManagerFa= ctoryClass"; + private static String URL =3D "javax.jdo.option.ConnectionURL= "; + private static String USERNAME =3D "javax.jdo.option.ConnectionUse= rName"; + private static String PASSWORD =3D "javax.jdo.option.ConnectionPas= sword"; + + + /** set IgnoreCache to true or false and use getIgnoreCache value to v= erify */=20 + public void test() { + Properties props =3D loadProperties(PMFProperties); + pmfClass =3D props.getProperty(PMFCLASS); =20 + url =3D props.getProperty(URL); + username =3D props.getProperty(USERNAME); =20 + password =3D props.getProperty(PASSWORD); =20 + + try { + Class cl =3D Class.forName(pmfClass); + pmf =3D (PersistenceManagerFactory) cl.newInstance(); + pmf.setIgnoreCache(false); + if (pmf.getIgnoreCache() !=3D false) { + fail(ASSERTION_FAILED, + "IgnoreCache set to false, value returned by PMF is "= + + pmf.getIgnoreCache()); + } + pmf.setIgnoreCache(true); + if (pmf.getIgnoreCache() !=3D true) { + fail(ASSERTION_FAILED, + "IgnoreCache set to true, value returned by PMF is " + + pmf.getIgnoreCache()); + } + } catch (Exception ex) { + fail(ASSERTION_FAILED, + "Failed in setting IgnoreCache" + ex); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/pers= istencemanagerfactory/SetIgnoreCache.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persisten= cemanagerfactory/SetMultithreaded.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/api/persistencemanagerfactory/SetMultithreaded.java?view=3Da= uto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetMultithreaded.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetMultithreaded.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,104 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ +=20 +package org.apache.jdo.tck.api.persistencemanagerfactory; + +import java.util.Properties; + +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + + +/** + *Title:Set Multithreaded of persistencemanagerfactory =20 + *
+ *Keywords: persistencemanagerfactory + *
+ *Assertion IDs: A11.1-11,A11.1-12. + *
+ *Assertion Description: + *PersistenceManagerFactory.setMultithreaded(boolean flag) sets the value = of the Multithreaded flag that indicates that the application will invoke m= ethods or access fields of managed instances from multiple threads.=20 + */ + +/*=20 + * Revision History + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Author : Linga Neerathilingam + * Date : 10/15/01 + * Version : 1.0 + * + */ + +public class SetMultithreaded extends JDO_Test { + =20 + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertions A11.1-11,A11.1-12 (SetMultithreaded) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(SetMultithreaded.class); + } + + private PersistenceManagerFactory pmf; + private PersistenceManager pm; + private String pmfClass; + private String url; + private String username; + private String password; + + private static String PMFCLASS =3D "javax.jdo.PersistenceManagerFa= ctoryClass"; + private static String URL =3D "javax.jdo.option.ConnectionURL= "; + private static String USERNAME =3D "javax.jdo.option.ConnectionUse= rName"; + private static String PASSWORD =3D "javax.jdo.option.ConnectionPas= sword"; + + /** set Multithreaded to true or false and use getMultithreaded value = to verify */=20 + public void test() { + Properties props =3D loadProperties(PMFProperties); + pmfClass =3D props.getProperty(PMFCLASS); =20 + url =3D props.getProperty(URL); + username =3D props.getProperty(USERNAME); =20 + password =3D props.getProperty(PASSWORD); =20 + + try { + Class cl =3D Class.forName(pmfClass); + pmf =3D (PersistenceManagerFactory) cl.newInstance(); + pmf.setMultithreaded(true); + if (pmf.getMultithreaded() !=3D true) { + fail(ASSERTION_FAILED, + "Multithreaded set to true, value returned by PMF is = " + + pmf.getMultithreaded()); + } + pmf.setMultithreaded(false); + if (pmf.getMultithreaded() !=3D false) { + fail(ASSERTION_FAILED, + "Multithreaded set to false, value returned by PMF is= " + + pmf.getMultithreaded()); + } + }=20 + catch (Exception ex) { + fail(ASSERTION_FAILED, + "Failed in setting Multithreaded " + ex); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/pers= istencemanagerfactory/SetMultithreaded.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persisten= cemanagerfactory/SetNonTransactionalRead.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalRead.java?v= iew=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetNonTransactionalRead.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetNonTransactionalRead.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,105 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ +=20 +package org.apache.jdo.tck.api.persistencemanagerfactory; + +import java.util.Properties; + +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + + +/** + *Title:Set NonTransactionalRead of persistencemanagerfactory =20 + *
+ *Keywords: persistencemanagerfactory + *
+ *Assertion IDs: A11.1-7,A11.1-8. + *
+ *Assertion Description: + *PersistenceManagerFactory.setNontransactionalRead(boolean flag) sets the= value of the NontransactionalRead property (the PersistenceManager mode th= at allows instances to be read outside a transaction).=20 + */ + +/*=20 + * Revision History + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Author : Linga Neerathilingam + * Date : 10/15/01 + * Version : 1.0 + * + */ + +public class SetNonTransactionalRead extends JDO_Test { + =20 + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertions A11.1-7,A11.1-8 (SetNonTransactionalRead) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(SetNonTransactionalRead.class); + } + + private PersistenceManagerFactory pmf; + private PersistenceManager pm; + private String pmfClass; + private String url; + private String username; + private String password; + + private static String PMFCLASS =3D "javax.jdo.PersistenceManagerFa= ctoryClass"; + private static String URL =3D "javax.jdo.option.ConnectionURL= "; + private static String USERNAME =3D "javax.jdo.option.ConnectionUse= rName"; + private static String PASSWORD =3D "javax.jdo.option.ConnectionPas= sword"; + + + /** set NonTransactionalRead to true or false and use getNonTransactio= nalRead value to verify */=20 + public void test() { + Properties props =3D loadProperties(PMFProperties); + pmfClass =3D props.getProperty(PMFCLASS); =20 + url =3D props.getProperty(URL); + username =3D props.getProperty(USERNAME); =20 + password =3D props.getProperty(PASSWORD); =20 + + try { + Class cl =3D Class.forName(pmfClass); + pmf =3D (PersistenceManagerFactory) cl.newInstance(); + pmf.setNontransactionalRead(false); + if (pmf.getNontransactionalRead() !=3D false) { + fail(ASSERTION_FAILED, + "NonTransactionalRead set to false, value returned by= PMF is " + + pmf.getNontransactionalRead()); + } + pmf.setNontransactionalRead(true); + if (pmf.getNontransactionalRead() !=3D true) { + fail(ASSERTION_FAILED, + "NonTransactionalRead set to true, value returned by = PMF is " + + pmf.getNontransactionalRead()); + } + }=20 + catch (Exception ex) { + fail(ASSERTION_FAILED, + "Failed in setting NonTransactionalRead " + ex); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/pers= istencemanagerfactory/SetNonTransactionalRead.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persisten= cemanagerfactory/SetNonTransactionalWrite.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalWrite.java?= view=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetNonTransactionalWrite.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetNonTransactionalWrite.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,104 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ +=20 +package org.apache.jdo.tck.api.persistencemanagerfactory; + +import java.util.Properties; + +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + + +/** + *Title:Set NonTransactionalWrite of persistencemanagerfactory=20 + *
+ *Keywords: persistencemanagerfactory + *
+ *Assertion IDs: A11.1-9,A11.1-10. + *
+ *Assertion Description: + * PersistenceManagerFactory.setNontransactionalWrite(boolean flag) sets t= he value of the NontransactionalWrite property (the PersistenceManager mode= that allows instances to be written outside a transaction). + */ + +/*=20 + * Revision History + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Author : Linga Neerathilingam + * Date : 10/15/01 + * Version : 1.0 + * + */ + +public class SetNonTransactionalWrite extends JDO_Test { + =20 + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertions A11.1-9,A11.1-10 (SetNonTransactionalWrite) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(SetNonTransactionalWrite.class); + } + + private PersistenceManagerFactory pmf; + private PersistenceManager pm; + private String pmfClass; + private String url; + private String username; + private String password; + + private static String PMFCLASS =3D "javax.jdo.PersistenceManagerFa= ctoryClass"; + private static String URL =3D "javax.jdo.option.ConnectionURL= "; + private static String USERNAME =3D "javax.jdo.option.ConnectionUse= rName"; + private static String PASSWORD =3D "javax.jdo.option.ConnectionPas= sword"; + + + /** set NonTransactionalWrite to true or false and use getNonTransacti= onalWrite value to verify */=20 + public void test () { + Properties props =3D loadProperties(PMFProperties); + pmfClass =3D props.getProperty(PMFCLASS); =20 + url =3D props.getProperty(URL); + username =3D props.getProperty(USERNAME); =20 + password =3D props.getProperty(PASSWORD); =20 + + try { + Class cl =3D Class.forName(pmfClass); + pmf =3D (PersistenceManagerFactory) cl.newInstance(); + pmf.setNontransactionalWrite(false); + if (pmf.getNontransactionalWrite() !=3D false) { + fail(ASSERTION_FAILED, + "NonTransactionalWrite set to false, value returned b= y PMF is " + + pmf.getNontransactionalWrite()); + } + pmf.setNontransactionalWrite(true); + if (pmf.getNontransactionalWrite() !=3D true) { + fail(ASSERTION_FAILED, + "NonTransactionalWrite set to true, value returned by= PMF is " + + pmf.getNontransactionalWrite()); + } + } catch (Exception ex) { + fail(ASSERTION_FAILED, + "Failed in setting NonTransactionalWrite " + ex); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/pers= istencemanagerfactory/SetNonTransactionalWrite.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persisten= cemanagerfactory/SetOptimistic.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/api/persistencemanagerfactory/SetOptimistic.java?view=3Dauto= &rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetOptimistic.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetOptimistic.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,102 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ +=20 +package org.apache.jdo.tck.api.persistencemanagerfactory; + +import java.util.Properties; + +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + + +/** + *Title:Set optimistic of persistencemanagerfactory =20 + *
+ *Keywords: persistencemanagerfactory + *
+ *Assertion IDs: A11.1-1, A11.1-2. + *
+ *Assertion Description: + PersistenceManagerFactory.getOptimistic() returns Value of the Optimisti= c property,persistenceManagerFactory.setOptimistic(boolean flag) sets +the value of the Optimistic property (the transaction mode that specifies = concurrency control=20 + */ + +public class SetOptimistic extends JDO_Test { + =20 + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A11.1-1, A11.1-2 (SetOptimistic) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(SetOptimistic.class); + } + + private PersistenceManagerFactory pmf; + private PersistenceManager pm; + private String pmfClass; + private String url; + private String username; + private String password; + + private static String PMFCLASS =3D "javax.jdo.PersistenceManagerFa= ctoryClass"; + private static String URL =3D "javax.jdo.option.ConnectionURL= "; + private static String USERNAME =3D "javax.jdo.option.ConnectionUse= rName"; + private static String PASSWORD =3D "javax.jdo.option.ConnectionPas= sword"; + + /** set Optimistic to true or false and use getOptimistic value to ver= ify */=20 + public void test() { + if (!isOptimisticSupported()) { + if (debug) + logger.debug("\n SetOptimistic() passed: this implementati= on does not support Optimistic."); + return; + } + =20 + Properties props =3D loadProperties(PMFProperties); + pmfClass =3D props.getProperty(PMFCLASS); =20 + url =3D props.getProperty(URL); + username =3D props.getProperty(USERNAME); =20 + password =3D props.getProperty(PASSWORD); =20 + + try { + Class cl =3D Class.forName(pmfClass); + pmf =3D (PersistenceManagerFactory) cl.newInstance(); + pmf.setOptimistic(false); + if (pmf.getOptimistic() !=3D false) { + fail(ASSERTION_FAILED, + "Optimistic set to false, value returned by PMF is " + + pmf.getOptimistic()); + } + pmf.setOptimistic(true); + if (pmf.getOptimistic() !=3D true) { + fail(ASSERTION_FAILED, + "Optimistic set to true, value returned by PMF is " + + pmf.getOptimistic()); + } + }=20 + catch (Exception ex) { + fail(ASSERTION_FAILED, + "Failed in setting Optimistic " + ex); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/pers= istencemanagerfactory/SetOptimistic.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persisten= cemanagerfactory/SetRetainValues.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/api/persistencemanagerfactory/SetRetainValues.java?view=3Dau= to&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetRetainValues.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SetRetainValues.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,104 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ +=20 +package org.apache.jdo.tck.api.persistencemanagerfactory; + +import java.util.Properties; + +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title:Set RetainValues of persistencemanagerfactory =20 + *
+ *Keywords: persistencemanagerfactory + *
+ *Assertion IDs: A11.1-3,A11.1-4. + *
+ *Assertion Description: + * PersistenceManagerFactory.setRetainValues(boolean flag) sets the value = of the RetainValues property (the transaction mode that specifies the treat= ment of persistent instances after commit), +PersistenceManagerFactory.getRetainValues() returns the value of the +RetainValues property. + */ + +/*=20 + * Revision History + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Author : Linga Neerathilingam + * Date : 10/18/01 + * Version : 1.0 + * + */ + +public class SetRetainValues extends JDO_Test { + =20 + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A11.1-3,A11.1-4 (SetRetainValues) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(SetRetainValues.class); + } + + private PersistenceManagerFactory pmf; + private PersistenceManager pm; + private String pmfClass; + private String url; + private String username; + private String password; + + private static String PMFCLASS =3D "javax.jdo.PersistenceManagerFa= ctoryClass"; + private static String URL =3D "javax.jdo.option.ConnectionURL= "; + private static String USERNAME =3D "javax.jdo.option.ConnectionUse= rName"; + private static String PASSWORD =3D "javax.jdo.option.ConnectionPas= sword"; + + /** set RetainValues to true or false and use getRetainValues value to= verify */=20 + public void test() { + Properties props =3D loadProperties(PMFProperties); + pmfClass =3D props.getProperty(PMFCLASS); =20 + url =3D props.getProperty(URL); + username =3D props.getProperty(USERNAME); =20 + password =3D props.getProperty(PASSWORD); =20 + + try { + Class cl =3D Class.forName(pmfClass); + pmf =3D (PersistenceManagerFactory) cl.newInstance(); + pmf.setRetainValues(false); + if (pmf.getRetainValues() !=3D false) { + fail(ASSERTION_FAILED, + "RetainValues set to false, value returned by PMF is = " + + pmf.getRetainValues()); + } + pmf.setRetainValues(true); + if (pmf.getRetainValues() !=3D true) { + fail(ASSERTION_FAILED, + "RetainValues set to true, value returned by PMF is "= + + pmf.getRetainValues()); + } + } catch (Exception ex) { + fail(ASSERTION_FAILED, + "Failed in setting RetainValues " + ex); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/pers= istencemanagerfactory/SetRetainValues.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persisten= cemanagerfactory/SupportedOptions.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/api/persistencemanagerfactory/SupportedOptions.java?view=3Da= uto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SupportedOptions.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencem= anagerfactory/SupportedOptions.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ +=20 +package org.apache.jdo.tck.api.persistencemanagerfactory; + +import java.util.Collection; +import java.util.Iterator; + +import javax.jdo.PersistenceManagerFactory; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + + +/** + *Title:SupportedOptions of persistencemanagerfactory =20 + *
+ *Keywords: persistencemanagerfactory + *
+ *Assertion IDs: A11.5-1. + *
+ *Assertion Description: + * PersistenceManagerFactory.supportedOptions() returns a Collection +of String, each String instance representing an optional feature of the +implementation or a supported query language.=20 + */ + +/*=20 + * Revision History + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Author : Linga Neerathilingam + * Date : 10/22/01 + * + */ + +public class SupportedOptions extends JDO_Test { + =20 + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A11.5-1 (SupportedOptions) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(SupportedOptions.class); + } + + /** */ + public void test() { + PersistenceManagerFactory pmf =3D getPMF(); + if (debug) logger.debug("Options supported by this implementation:= "); + Collection c =3D pmf.supportedOptions(); + Iterator iter =3D c.iterator(); + while( iter.hasNext() ){ + String option =3D (String) iter.next(); + if (debug) logger.debug(option); + } + } =20 +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/pers= istencemanagerfactory/SupportedOptions.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/E= nhancerTest.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/enhancement/EnhancerTest.java?view=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/Enha= ncerTest.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/Enha= ncerTest.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,100 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +/* + * EnhancerTest.java + * + * Created on February 17, 2002, 1:59 PM + */ + +package org.apache.jdo.tck.enhancement; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.Properties; +import java.util.StringTokenizer; + +import org.apache.jdo.tck.JDO_Test; + +/** + * + * @author Craig Russell + * @version 1.0 + */ +public abstract class EnhancerTest extends JDO_Test { + + /** Creates new EnhancerTest */ + public EnhancerTest() { + } + + /** */ + protected Properties getProperties(String resourceName) { + Properties props =3D null; + try { + InputStream in =3D this.getClass().getClassLoader().getResourc= eAsStream(resourceName); + props =3D new Properties(); + props.load(in); + } catch (Exception ex) { + ex.printStackTrace(); + fail("EnhancerTest:", + "Error loading properties " + resourceName + " exception = " + ex); + } + return props; + } + =20 + /** */ + protected abstract void runTestOnePackage (String packageName, List fu= llyQualifiedClassNameList); + =20 + /** */ + protected String convertClassName (String packageName, String classNam= e) { + return packageName + "." + className; + } + + /** */ + void runTestAllPackages() { + /** First, get classes to test from properties file. + */ + Properties classesToTest =3D getProperties("enhancement-test.prope= rties"); //NOI18N + =20 + Enumeration enum =3D classesToTest.propertyNames(); + int numberOfPackages =3D 0; + =20 + /** Each key is a package name; the value is a list of class names= to test. + */ + while (enum.hasMoreElements()) { + ++numberOfPackages; + String packageName =3D (String) enum.nextElement(); + if (debug) logger.debug("EnhancerTest Package: " + packageName= ); + String classNames =3D (String) classesToTest.get(packageName); + if (debug) logger.debug("EnhancerTest Classes: " + classNames); + StringTokenizer st =3D new StringTokenizer(classNames, " ,"); + ArrayList classNameList =3D new ArrayList(); + /** Each entry is a list of class names separated by comma or = space + */ + while (st.hasMoreTokens()) { + String className =3D st.nextToken(); + String listEntry =3D convertClassName(packageName, classNa= me); + classNameList.add (listEntry); + if (debug) logger.debug("EnhancerTest Class: " + className= ); + } + runTestOnePackage (packageName, classNameList); + } + if (debug) logger.debug("EnhancerTest numberOfPackages: " + number= OfPackages); + return; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancem= ent/EnhancerTest.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/F= ieldAccessModified.java.fix URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/enhancement/FieldAccessModified.java.fix?view=3Dauto&rev=3D1= 60090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/Fiel= dAccessModified.java.fix (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/Fiel= dAccessModified.java.fix Mon Apr 4 12:41:23 2005 @@ -0,0 +1,107 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +package org.apache.jdo.tck.enhancement; + +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.List; + +import org.apache.jdo.impl.enhancer.util.AnnotationTest; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: FieldAccessModified + *
+ *Keywords: enhancement + *
+ *Assertion ID: . + *
+ *Assertion Description: +The enhancer modifies field accesses to guarantee that the values of fields +are retrieved from the data store prior to application usage. +
    +
  1. For any field access that reads the value of a field, the getfield byt= e code +is replaced with a call to a generated local method, jdoGetXXX
  2. +
  3. For any field access that stores the new value of a field, the putfield +byte code is replaced with a call to a generated local method, +jdoSetXXX
  4. +
+ + */ + +public class FieldAccessModified extends EnhancerTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion (FieldAccessModified) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(FieldAccessModified.class); + } + + =20 + /** */ + public void test() { + if (debug) + logger.debug("org.apache.jdo.tck.enhancement.FieldAccessModifi= ed.run"); + PMFPropertiesObject =3D loadProperties(PMFProperties); // will exi= t here if no properties + runTestAllPackages(); + cleanup(); + } + + /** */ + protected void runTestOnePackage (String packageName, List classNames)= { + if (debug) + logger.debug("FieldAccessModified.testOnePackage: " +=20 + packageName + " classes " + classNames); + =20 + PrintWriter out =3D new PrintWriter(System.out); + final AnnotationTest test =3D new AnnotationTest(out, out); + final String classpath =3D System.getProperty("java.class.path"); + final String jdoPropertiesFileName =3D=20 + packageName.replace ('.', '/') + "/jdoTest.properties"; //NOI1= 8N =20 + final String[] args =3D new String[classNames.size() + 6]; + int index =3D 0; + // init arguments for AnnotationTest.run call + // specify properties file + args[index++] =3D "--properties"; + args[index++] =3D jdoPropertiesFileName; + // specify jdo path to find the properties file + args[index++] =3D "-j"; + args[index++] =3D classpath; + // specify source path to find the classes + args[index++] =3D "-s"; + args[index++] =3D classpath; + // add class names + for (java.util.Iterator i =3D classNames.iterator(); i.hasNext();)= { + args[index++] =3D (String)i.next(); + } + if (debug) + logger.debug ("Run AnnotationTest with args " + Arrays.asList(= args)); + int errors =3D test.run(args); + if (errors > 0) { + fail(ASSERTION_FAILED, + "AnnotationTest with args " + Arrays.asList(args) + + " results in " + errors + " errors."); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancem= ent/FieldAccessModified.java.fix ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/I= mplementsPersistenceCapable.java.fix URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java.fix?view=3Daut= o&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/Impl= ementsPersistenceCapable.java.fix (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/Impl= ementsPersistenceCapable.java.fix Mon Apr 4 12:41:23 2005 @@ -0,0 +1,100 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +package org.apache.jdo.tck.enhancement; + +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.List; + +import org.apache.jdo.impl.enhancer.util.AugmentationTest; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Implements PersistenceCapable Added + *
+ *Keywords: enhancement + *
+ *Assertion ID: A20.3-0. + *
+ *Assertion Description: +The Reference Enhancer makes the following change +to persistence-capable classes: +it adds "implements javax.jdo.PersistenceCapable" +to the class definition. + + */ + +public class ImplementsPersistenceCapable extends EnhancerTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A20.3-0 (ImplementsPersistenceCapable) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(ImplementsPersistenceCapable.class); + } + + /** */ + public void test() { + if (debug) + logger.debug("org.apache.jdo.tck.enhancement.ImplementsPersist= enceCapable.run"); + runTestAllPackages(); + cleanup(); + } + + /** */ + protected void runTestOnePackage (String packageName, List classNames)= { + if (debug)=20 + logger.debug("ImplementsPersistenceCapable.testOnePackage: " +=20 + packageName + " classes " + classNames); + =20 + PrintWriter out =3D new PrintWriter(System.out); + final AugmentationTest test =3D new AugmentationTest(out, out); + final String classpath =3D System.getProperty("java.class.path"); + final String jdoPropertiesFileName =3D=20 + packageName.replace ('.', '/') + "/jdoTest.properties"; //NOI1= 8N =20 + final String[] args =3D new String[classNames.size() + 6]; + int index =3D 0; + // init arguments for AugmentationTest.run call + // specify properties file + args[index++] =3D "--properties"; + args[index++] =3D jdoPropertiesFileName; + // specify jdo path to find the properties file + args[index++] =3D "-j"; + args[index++] =3D classpath; + // specify source path to find the classes + args[index++] =3D "-s"; + args[index++] =3D classpath; + // add class names + for (java.util.Iterator i =3D classNames.iterator(); i.hasNext();)= { + args[index++] =3D (String)i.next(); + } + if (debug) + logger.debug ("Run AugmentationTest with args " + Arrays.asLis= t(args)); + int errors =3D test.run(args); + if (errors > 0) { + fail(ASSERTION_FAILED, + "AugmentationTest with args " + Arrays.asList(args) + + " results in " + errors + " errors."); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancem= ent/ImplementsPersistenceCapable.java.fix ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Close= All.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/CloseAll.java?view=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseAll= .java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseAll= .java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,85 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import java.util.Iterator; + +import javax.jdo.Extent; + +import org.apache.jdo.tck.pc.company.Employee; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: CloseAll + *
+ *Keywords: extent + *
+ *Assertion ID: A15.3-12. + *
+ *Assertion Description: +After a call to Extent.closeAll(), all iterators acquired fro= m this +Extent will return false to hasNext(). + + */ + +public class CloseAll extends ExtentTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-12 (CloseAll) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(CloseAll.class); + } + + /** */ + public void test() { + try { + beginTransaction(); + Extent ex =3D getPM().getExtent (Employee.class, true); + Iterator it1 =3D ex.iterator(); + deleteEmployee((Employee)it1.next()); + Iterator it2 =3D ex.iterator(); + addEmployee(); + Iterator it3 =3D ex.iterator(); + ex.closeAll(); + if (it1.hasNext()) { + fail(ASSERTION_FAILED, + "After extent.closeAll() iterator1.hasNext(): " + it1= .hasNext()); + } + if (it2.hasNext()) { + fail(ASSERTION_FAILED, + "After extent.closeAll() iterator2.hasNext(): " + it2= .hasNext()); + } + if (it3.hasNext()) { + fail(ASSERTION_FAILED, + "After extent.closeAll() iterator3.hasNext(): " + it3= .hasNext()); + } + if (debug) logger.debug("Assertion A15.3-12 passed"); + }=20 + finally { + rollbackTransaction(); + cleanup(); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= CloseAll.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Close= OfExtentIteratorIsIteratorSpecific.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/CloseOfExtentIteratorIsIteratorSpecific.java?view=3D= auto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseOfE= xtentIteratorIsIteratorSpecific.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseOfE= xtentIteratorIsIteratorSpecific.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,77 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import java.util.Collection; +import java.util.Iterator; + +import javax.jdo.Extent; +import javax.jdo.Query; + +import org.apache.jdo.tck.util.BatchTestRunner; + + +/** + *Title: Close of Extent Iterator is Iterator Specific + *
+ *Keywords: extent + *
+ *Assertion ID: A15.3-11. + *
+ *Assertion Description: +After a call to Extent.close(Iterator i), +the Extent itself can still be used to acquire other +iterators and can be used as the Extent for queries. + + */ + +public class CloseOfExtentIteratorIsIteratorSpecific extends ExtentTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-11 (CloseOfExtentIteratorIsIteratorSpecific) fail= ed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(CloseOfExtentIteratorIsIteratorSpecific.class); + } + + /** */ + public void test() { + Extent ex =3D getExtent(); + Iterator it1 =3D ex.iterator(); + ex.close(it1); + int count =3D countIterator(ex.iterator()); + if (count !=3D 2) { + fail(ASSERTION_FAILED, + "iterating Employees after close of first iterator; count= ed " + count + " instances; should be 2"); + } + Query q =3D getPM().newQuery(ex); + Collection c =3D (Collection)q.execute(); + int count2 =3D countIterator(c.iterator()); + if (count2 !=3D 2) { + fail(ASSERTION_FAILED, + "in query after closing iterator; counted " + count + " i= nstances; should be 2"); + } + if (debug) logger.debug("Assertion A15.3-11 passed"); + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= CloseOfExtentIteratorIsIteratorSpecific.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Exten= tTest.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/ExtentTest.java?view=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/ExtentTe= st.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/ExtentTe= st.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,260 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +package org.apache.jdo.tck.extents; + + +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashSet; +import java.util.Iterator; +import java.util.TimeZone; + +import javax.jdo.Extent; +import javax.jdo.JDOFatalInternalException; +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.company.Address; +import org.apache.jdo.tck.pc.company.Company; +import org.apache.jdo.tck.pc.company.Department; +import org.apache.jdo.tck.pc.company.Employee; +import org.apache.jdo.tck.pc.company.FullTimeEmployee; +import org.apache.jdo.tck.pc.company.DentalInsurance; +import org.apache.jdo.tck.pc.company.MedicalInsurance; +import org.apache.jdo.tck.pc.company.PartTimeEmployee; +import org.apache.jdo.tck.pc.company.Project; + +/** + * + * @author Craig Russell + * @version 1.0 + */ +abstract class ExtentTest extends JDO_Test { + + protected Class extentClass =3D Employee.class; + protected Company company; + protected Object companyOID; + =20 + /** Creates new ExtentTest */ + public ExtentTest() { + if (PMFProperties =3D=3D null) + { + PMFProperties =3D System.getProperty("user.home") + "/.jdo/PMF= Properties.properties"; + if (PMFProperties =3D=3D null) + System.out.println ("Please specify PMF properties in {use= r=2Ehome}/.jdo/PMFProperties.properties"); + } + } + =20 + /** */ + protected void checkPM() { + try { + Extent ex =3D getPM().getExtent(Company.class, false); + int count =3D countIterator(ex.iterator()); + if (count =3D=3D 1) { + if (debug) logger.debug ("Found company"); + return; + } + } catch (Exception e) { + e.printStackTrace(System.err); + System.err.println ("Failed to find Company; initializing DB"); + } + initDB(); + } + =20 + /** */ + protected void initDB() { + HashSet h; + Address addr1 =3D new Address (7001L, "18 Network Circle", + "Santa Clara", "CA", "94455", "USA"); + company =3D new Company (1L, "Sun Microsystems", new Date(), addr1= ); + GregorianCalendar born =3D + new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angele= s")); + GregorianCalendar hired =3D + new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angele= s")); + + born.set(1969, 7, 20); + hired.set(1982, 5, 5); + Address addr2 =3D new Address (7002L, "43 Sematery Drive", + "Woodside", "CA", "94320", "USA"); + Employee scott =3D new FullTimeEmployee(3001L, "Scott", "McNealy",= "G",=20 + born.getTime(), addr2,=20 + hired.getTime(), 200000.0); + born.set(1960, 4, 8); + hired.set(1985, 2, 3); + Address addr3 =3D new Address (7003L, "1298 Wanderlust Road", + "Pleasanton", "CA", "95560", "USA"); + Employee ed =3D new PartTimeEmployee(3002L, "Ed", "Zander", null,=20 + born.getTime(), addr3,=20 + hired.getTime(), 400000.0);=20 + scott.addToTeam(ed); + + // Set up their departments. + Department board =3D + new Department(2001L, "board", company); + h =3D new HashSet(); + h.add(scott); + board.setEmployees(h); + scott.setDepartment(board); + =20 + company.addDepartment(board); + + Department emg =3D new Department(2002L, "emg", company); + h =3D new HashSet(); + h.add(ed); + emg.setEmployees(h); + ed.setDepartment(emg); + =20 + company.addDepartment(emg); + + // Insure these guys + DentalInsurance scottDentalIns =3D new DentalInsurance( + 5001L, "Aetna", scott, new BigDecimal("12000")); + MedicalInsurance scottMedicalIns =3D new MedicalInsurance( + 5002L, "Aetna", scott, "PPO"); + DentalInsurance edDentalIns =3D new DentalInsurance( + 5003L, "BlueCross", ed, new BigDecimal("10000")); + MedicalInsurance edMedicalIns =3D new MedicalInsurance( + 5004L, "BlueCross", ed, "EPO"); + scott.setDentalInsurance(scottDentalIns); + scott.setMedicalInsurance(scottMedicalIns); + ed.setDentalInsurance(edDentalIns); + ed.setMedicalInsurance(edMedicalIns); + + // Give them some projects to work on. Scott works on both; Ed on= ly + // on one. + Project solaris =3D new Project(4001L, "Solaris", new BigDecimal(1= 00.375)); + Project sparc =3D new Project(4002L, "Sparc", new BigDecimal(200.5= 00)); + h =3D new HashSet(); + h.add(scott); + h.add(ed); + solaris.setMembers(h); // Solaris is worked on by Scott and Ed + + h =3D new HashSet(); + h.add(scott); + sparc.setMembers(h); // Sparc is worked on by Scott + =20 + h =3D new HashSet(); + h.add(solaris); + h.add(sparc); + scott.setProjects(h); // Scott works on Solaris and Sparc + + h =3D new HashSet(); + h.add(solaris); + ed.setProjects(h); // Ed works on Solaris + =20 + /* Now put all of these into the database + */ + pm.currentTransaction().begin(); + pm.makePersistent (company); + pm.currentTransaction().commit(); + // System.out.println ("Company OID: " + pm.getObjectId(company)); + } + =20 + /** */ + protected Employee addEmployee() { + Address addr1 =3D new Address (7004L, "456 Chelsey Lane",=20 + "Mountain View", "CA", "94040", "USA"= ); + Employee emp1 =3D new FullTimeEmployee (3003L, "First3003", "Last3= 003", "Middle3003",=20 + new Date(), addr1, new Date(= ), 10000.0); + getPM().makePersistent (emp1); + return emp1; + } + =20 + /** */ + protected void deleteEmployee(Employee e) { + getPM().deletePersistent (e); + } + + /** */ + protected int countIterator(Iterator it) { + int count =3D 0; + for (;it.hasNext();count++, it.next()); + return count; + } + =20 + /** */ + protected int printIterator(Iterator it) { + int count =3D 0; + for (;it.hasNext();count++) { + System.out.println (it.next().toString()); + } + return count; + } + =20 + /** */ + protected Extent getExtent() { + return getPM().getExtent(extentClass, true); + } + =20 + /** */ + protected Object getCompanyOID () { + String companyOIDString =3D (String) + PMFPropertiesObject.get("org.apache.jdo.tck.extents.CompanyOID= "); + String companyOIDClassName =3D (String) + PMFPropertiesObject.get("org.apache.jdo.tck.extents.CompanyOID= Class"); + if (companyOIDClassName =3D=3D null) { + companyOIDClassName =3D "org.apache.jdo.impl.fostore.OID"; + } + try { + Class companyOIDClass =3D Class.forName(companyOIDClassName); + Constructor companyOIDConstructor =3D companyOIDClass.getConst= ructor(new Class[] {String.class}); + Object companyOID =3D companyOIDConstructor.newInstance (new O= bject[] {companyOIDString}); + return companyOID; + }=20 + catch (Exception ex) { + throw new JDOFatalInternalException ( + "PMFProperties must be configured with the following prope= rties\n" + + "\torg.apache.jdo.tck.extents.CompanyOID =3D \n" + + "\torg.apache.jdo.tck.extents.CompanyOIDClass =3D \n", ex); + } + } + =20 + /** */ + protected PersistenceManager getPM() { + if (pm =3D=3D null) { + pm =3D getPMF().getPersistenceManager(); + checkPM(); + } + return pm; + } + =20 + /** */ + public PersistenceManagerFactory getPMF() { + if (pmf =3D=3D null) { + pmf =3D super.getPMF(); + } + return pmf; + } + =20 + /** */ + protected void beginTransaction() { + getPM().currentTransaction().begin(); + } + =20 + /** */ + protected void commitTransaction() { + getPM().currentTransaction().commit(); + } + =20 + /** */ + protected void rollbackTransaction() { + getPM().currentTransaction().rollback(); + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= ExtentTest.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetCa= ndidateClass.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/GetCandidateClass.java?view=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetCandi= dateClass.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetCandi= dateClass.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,60 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import javax.jdo.Extent; + +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Get Candidate Class + *
+ *Keywords: extent + *
+ *Assertion ID: A15.3-7. + *
+ *Assertion Description: +Extent.getCandidateClass() returns the class of the instances +contained in this Extent. + + */ + +public class GetCandidateClass extends ExtentTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-7 (GetCandidateClass) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(GetCandidateClass.class); + } + + /** */ + public void test() { + Extent ex =3D getExtent(); + if (extentClass !=3D ex.getCandidateClass()) { + fail(ASSERTION_FAILED, + "Candidate class in extent should be: " + extentClass.get= Class().getName()); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= GetCandidateClass.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetPe= rsistenceManager.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/GetPersistenceManager.java?view=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetPersi= stenceManager.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetPersi= stenceManager.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,62 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import javax.jdo.Extent; + +import org.apache.jdo.tck.pc.company.Employee; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Get PersistenceManager + *
+ *Keywords: extent + *
+ *Assertion ID: A15.3-8. + *
+ *Assertion Description: +Extent.getPersistenceManager() returns the +PersistenceManager which created this Extent. + + */ + +public class GetPersistenceManager extends ExtentTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-8 (GetPersistenceManager) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(GetPersistenceManager.class); + } + + /** */ + public void test() { + Extent ex =3D getPM().getExtent (Employee.class, true); + if (pm !=3D ex.getPersistenceManager()) { + fail(ASSERTION_FAILED, + "unexpected pm of extent, expected " + pm +=20 + ", got " + ex.getPersistenceManager()); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= GetPersistenceManager.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSu= bclassesFalse.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/HasSubclassesFalse.java?view=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubcl= assesFalse.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubcl= assesFalse.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,61 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import javax.jdo.Extent; + +import org.apache.jdo.tck.pc.company.Employee; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Has Subclasses is False + *
+ *Keywords: extent inheritance + *
+ *Assertion ID: A15.3-5. + *
+ *Assertion Description: +Extent.hasSubclasses() returns false +if the extent does not include subclasses. + + */ + +public class HasSubclassesFalse extends ExtentTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-5 (HasSubclassesFalse) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(HasSubclassesFalse.class); + } + + /** */ + public void test() { + Extent ex =3D getPM().getExtent (Employee.class, false); + if (ex.hasSubclasses()) { + fail(ASSERTION_FAILED, + "ex.hasSubclasses() returned true, but extent was created= with subclasses=3Dfalse."); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= HasSubclassesFalse.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSu= bclassesTrue.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/HasSubclassesTrue.java?view=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubcl= assesTrue.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubcl= assesTrue.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,61 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import javax.jdo.Extent; + +import org.apache.jdo.tck.pc.company.Employee; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Has Subclasses is True + *
+ *Keywords: extent inheritance + *
+ *Assertion ID: A15.3-6. + *
+ *Assertion Description: +Extent.hasSubclasses() returns true +if the extent includes subclasses. + + */ + +public class HasSubclassesTrue extends ExtentTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-6 (HasSubclassesTrue) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(HasSubclassesTrue.class); + } + + /** */ + public void test() { + Extent ex =3D getPM().getExtent (Employee.class, true); + if (!ex.hasSubclasses()) { + fail(ASSERTION_FAILED, + "ex.hasSubclasses() returned false, but extent was create= d with subclasses=3Dtrue."); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= HasSubclassesTrue.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Insta= ncesDeletedPriorToIterationNotReturned.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/InstancesDeletedPriorToIterationNotReturned.java?vie= w=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Instance= sDeletedPriorToIterationNotReturned.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Instance= sDeletedPriorToIterationNotReturned.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,84 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import java.util.Iterator; + +import javax.jdo.Extent; + +import org.apache.jdo.tck.pc.company.Employee; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Instances Deleted Prior to Iteration not Returned + *
+ *Keywords: extent + *
+ *Assertion ID: A15.3-3. + *
+ *Assertion Description: +If instances were deleted in the transaction prior to the execution of +Extent.iterator(), the returned Iterator +will not contain the instances. + + */ + +public class InstancesDeletedPriorToIterationNotReturned extends ExtentTes= t { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-3 (InstancesDeletedPriorToIterationNotReturned) f= ailed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(InstancesDeletedPriorToIterationNotReturned.cl= ass); + } + + /** */ + public void test() { + try { + beginTransaction(); + getPM().setIgnoreCache(false); + Extent ex =3D getPM().getExtent (Employee.class, true); + Iterator it1 =3D ex.iterator(); + deleteEmployee((Employee)it1.next()); + Iterator it2 =3D ex.iterator(); + int count =3D countIterator(it2); + rollbackTransaction(); + =20 + Iterator it3 =3D ex.iterator(); + int count3 =3D countIterator(it3); + =20 + if (count !=3D 1) { + fail(ASSERTION_FAILED, + "counted " + count + " after delete; should be 1"); + } + if (count3 !=3D 2) { + fail(ASSERTION_FAILED, + "counted " + count3 + "after rollback; should be 2"); + } + }=20 + finally { + cleanup(); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= InstancesDeletedPriorToIterationNotReturned.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Insta= ncesPersistedPriorToIterationReturned.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/InstancesPersistedPriorToIterationReturned.java?view= =3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Instance= sPersistedPriorToIterationReturned.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Instance= sPersistedPriorToIterationReturned.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,84 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import java.util.Iterator; + +import javax.jdo.Extent; + +import org.apache.jdo.tck.pc.company.Employee; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Instances Persisted Prior to Iteration Returned + *
+ *Keywords: extent + *
+ *Assertion ID: A15.3-2. + *
+ *Assertion Description: +If instances were made persistent in the transaction prior to the executio= n of +Extent.iterator(), the returned Iterator +will contain the instances. + + */ + +public class InstancesPersistedPriorToIterationReturned extends ExtentTest= { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-2 (InstancesPersistedPriorToIterationReturned) fa= iled: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(InstancesPersistedPriorToIterationReturned.cla= ss); + } + + /** */ + public void test() { + + try { + beginTransaction(); + getPM().setIgnoreCache(false); + Extent ex =3D getPM().getExtent (Employee.class, true); + addEmployee(); + Iterator it =3D ex.iterator(); + int count =3D countIterator(it); + rollbackTransaction(); + =20 + Iterator it2 =3D ex.iterator(); + int count2 =3D countIterator(it2); + =20 + if (count !=3D 3) { + fail(ASSERTION_FAILED, + "Iterator: " + count + " should be 3"); + } + if (count2 !=3D 2) { + fail(ASSERTION_FAILED, + "Iterator2: " + count2 + "should be 2"); + } + }=20 + finally { + cleanup(); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= InstancesPersistedPriorToIterationReturned.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Itera= torHasNextFalseAfterExtentClose.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/IteratorHasNextFalseAfterExtentClose.java?view=3Daut= o&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Iterator= HasNextFalseAfterExtentClose.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Iterator= HasNextFalseAfterExtentClose.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,97 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import java.util.Iterator; + +import javax.jdo.Extent; + +import org.apache.jdo.tck.pc.company.Employee; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Iterator HasNext returns False after Extent.close + *
+ *Keywords: extent + *
+ *Assertion ID: A15.3-9. + *
+ *Assertion Description: +After a call to Extent.close(Iterator i), +the parameter Iterator will return false +to hasNext(). + + */ + +public class IteratorHasNextFalseAfterExtentClose extends ExtentTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-9 (IteratorHasNextFalseAfterExtentClose) failed: = "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(IteratorHasNextFalseAfterExtentClose.class); + } + + /** */ + public void test() { + + try { + beginTransaction(); + Extent ex =3D getPM().getExtent (Employee.class, true); + Iterator it1 =3D ex.iterator(); + deleteEmployee((Employee)it1.next()); + Iterator it2 =3D ex.iterator(); + addEmployee(); + Iterator it3 =3D ex.iterator(); + ex.close(it1); + ex.close(it2); + ex.close(it3); + rollbackTransaction(); + =20 + Iterator it4 =3D ex.iterator(); + int count4 =3D countIterator(it4); + if (debug) logger.debug ("Iterator4 after rollback: " + count4= ); + =20 + if (it1.hasNext()) { + fail(ASSERTION_FAILED, + "iterator1.hasNext(): " + it1.hasNext()); + } + if (it2.hasNext()) { + fail(ASSERTION_FAILED, + "iterator2.hasNext(): " + it2.hasNext()); + } + if (it3.hasNext()) { + fail(ASSERTION_FAILED, + "iterator3.hasNext(): " + it3.hasNext()); + } + if (count4 !=3D 2) { + fail(ASSERTION_FAILED, + "Iterator " + count4 + " should be 2"); + } + }=20 + finally { + cleanup(); + } + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/= IteratorHasNextFalseAfterExtentClose.java ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Itera= torMutatingMethods.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/= apache/jdo/tck/extents/IteratorMutatingMethods.java?view=3Dauto&rev=3D160090 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Iterator= MutatingMethods.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/Iterator= MutatingMethods.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,73 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * Licensed 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + + +package org.apache.jdo.tck.extents; + +import java.util.Iterator; + +import javax.jdo.Extent; + +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Iterator Mutating Methods + *
+ *Keywords: extent exception + *
+ *Assertion ID: A15.3-4. + *
+ *Assertion Description: +If any mutating method, including the remove method, +is called on the Iterator returned by Extent.iterator()= , +an UnsupportedOperationException is thrown. + + */ + +public class IteratorMutatingMethods extends ExtentTest { + + /** */ + private static final String ASSERTION_FAILED =3D=20 + "Assertion A15.3-4 (IteratorMutatingMethods) failed: "; + =20 + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(IteratorMutatingMethods.class); + } + + /** */ + public void test() { + Extent ex =3D getExtent(); + Iterator it =3D ex.iterator(); + it.next(); + try { + it.remove();=20 + fail(ASSERTION_FAILED, + "extent.iterator().remove() should throw UnsupportedOpera= tionException"); + } + catch (UnsupportedOperationException expected) { + // expected exception + if (debug) logger.debug("expected exception " + ex); + }=20 + finally { + cleanup(); + } + } +}