db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r491121 [2/3] - in /db/jdo/trunk: enhancer20/test/ fostore20/test/ fostore20/test/fsuid2/ tck11/test/java/org/apache/jdo/tck/util/ tck20/ tck20/src/java/org/apache/jdo/tck/api/jdohelper/ tck20/src/java/org/apache/jdo/tck/api/persistencemana...
Date Fri, 29 Dec 2006 22:18:42 GMT
Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/PersistenceManagerNullsTest.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/PersistenceManagerNullsTest.java?view=diff&rev=491121&r1=491120&r2=491121
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/PersistenceManagerNullsTest.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/PersistenceManagerNullsTest.java Fri Dec 29 14:18:40 2006
@@ -1,542 +1,542 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- * 
- * 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 
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.api.persistencemanager.nullargs;
-
-
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.jdo.JDOHelper;
-import javax.jdo.PersistenceManager;
-import javax.jdo.Transaction;
-
-import org.apache.jdo.tck.JDO_Test;
-import org.apache.jdo.tck.pc.mylib.PCPoint;
-
-/**
-  * The superclass for the tests of null arguments to pm methods.
-  *
-  * Null arguments to APIs that take an Object parameter cause the API 
-  * to have no effect. Null arguments to APIs that take Object[] or Collection
-  * will cause the API to throw NullPointerException. Non-null Object[] or 
-  * Collection arguments that contain null elements will have the documented 
-  * behavior for non-null elements, and the null elements will be ignored.
-  *
-  */
-
-public class PersistenceManagerNullsTest extends JDO_Test {
-
-    /**
-    public static interface MethodUnderTest {
-        public void pmApi(PersistenceManager pm, Object obj);
-        public void pmApi(PersistenceManager pm, Collection coll);
-        public void pmApi(PersistenceManager pm, Object[] objs);
-        public Object pmApiReturn(PersistenceManager pm, Object obj);
-        public Collection pmApiReturn(PersistenceManager pm,  Collection coll);
-        public Object[] pmApiReturn(PersistenceManager pm, Object [ ] objs);
-    }
-     */
-
-    /**
-     */
-    public static class MethodUnderTest {
-        public void pmApi(PersistenceManager pm, Object obj) {
-            throw new UnsupportedOperationException("Test must implement this method");
-        }
-        public void pmApi(PersistenceManager pm, Collection coll) {
-            throw new UnsupportedOperationException("Test must implement this method");
-        }
-        public void pmApi(PersistenceManager pm, Object[] objs) {
-            throw new UnsupportedOperationException("Test must implement this method");
-        }
-        public Object pmApiReturn(PersistenceManager pm, Object obj) {
-            throw new UnsupportedOperationException("Test must implement this method");
-        }
-        public Collection pmApiReturn(PersistenceManager pm, Collection coll) {
-            throw new UnsupportedOperationException("Test must implement this method");
-        }
-        public Object[] pmApiReturn(PersistenceManager pm, Object[] objs) {
-            throw new UnsupportedOperationException("Test must implement this method");
-        }
-    } 
-
-
-    private static final String ASSERTION3_FAILED = 
-        "Assertion A12.6-3 failed: ";
-    
-    private static final String ASSERTION4_FAILED = 
-        "Assertion A12.6-4 failed: ";
-    
-    private static final String ASSERTION5_FAILED = 
-        "Assertion A12.6-5 failed: ";
-
-    protected PCPoint pNotNull = null;
-    protected Collection collNullElem = null;
-    protected Collection expectedCollection = null;
-    protected Object[] arrayNullElem = new Object[] {null, null};
-    protected Object[] expectedArray = new Object[] {null, null};
-    protected Collection testInstances = null;
-    
-    /** */
-    protected PersistenceManagerNullsTest() { }
-
-    /** 
-     * @see JDO_Test#localSetUp()
-     */
-    protected void localSetUp() {
-        // The order of addTearDownClass calls is significant
-        // as it takes into account database FKs.
-        addTearDownClass(PCPoint.class);
-
-        // Initialize test objects and expected values
-        pNotNull = new PCPoint(3, 5);
-        arrayNullElem[1] = pNotNull;
-        expectedArray[1] = pNotNull;
-        collNullElem = Arrays.asList(arrayNullElem);
-
-        pm = getPM();   
-        Transaction tx = pm.currentTransaction();
-        try {
-            tx = pm.currentTransaction();
-
-            tx.begin();
-            try {
-                pm.makePersistent(pNotNull);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            tx.commit();
-
-            logger.debug(" \nSetup committed in DeletePersistentNullArgs()");
-        }
-        finally {
-            if (tx.isActive()) {
-                tx.rollback();
-            }
-        }       expectedCollection = Arrays.asList(arrayNullElem);
-
-    }
-    
-    protected static String toString(Object[] objs) {
-        StringBuffer out = new StringBuffer();
-        for (int i=0; i < objs.length; i++) {
-            out.append("[" + i + "]: ");
-            if (objs[i] == null)
-                out.append("null");
-            else out.append(objs[i].toString());
-            out.append(",  ");
-        }
-        return out.toString();
-    }
-
-    protected static String toString(Collection objs) {
-        return toString(objs.toArray());
-    }
-
-    /**
-      * Checks if expected and actual arguments match for null/non-null value
-      * @return true if arguments match
-      * @param expected Collection
-      * @param actual Collection
-      */
-    protected boolean checkReturn(Collection expected, Collection actual) {
-        Object eElem = null;
-        Object aElem = null;
-        if (expected.size() != actual.size())
-            return false;
-        Iterator eIt = expected.iterator();
-        Iterator aIt = actual.iterator();
-        while (eIt.hasNext()) {
-            eElem = eIt.next();
-            aElem = aIt.next();
-            if ( (eElem == null && aElem != null)
-               || (aElem == null && eElem != null) )
-                return false;
-        }
-        return true;
-    }
-
-    /**
-      * Checks if expected and actual arguments match for null/non-null value
-      * @return true if arguments match
-      * @param expected Object[]
-      * @param actual Object[]
-      */
-    protected boolean checkReturn(Object[] expected, Object[] actual) {
-        Object eElem = null;
-        Object aElem = null;
-        if (expected.length != actual.length)
-            return false;
-        for (int i=0; i < expected.length; i++) {
-            eElem = expected[i];
-            aElem = actual[i];
-            if ( (eElem == null && aElem != null)
-               || (aElem == null && eElem != null) )
-                return false;
-        }
-        return true;
-    }
-
-    /** 
-     * Test that method under test with null valued argument does nothing.
-     */
-    public void executeNullObjectParameter(MethodUnderTest mut, String method) {
-
-        Transaction tx = pm.currentTransaction();
-        Object obj = null;
-        try {
-            tx = pm.currentTransaction();
-
-            tx.begin();
-            try {
-                mut.pmApi(pm, obj);
-            } catch (Exception e) {
-                fail(ASSERTION3_FAILED,
-                        method + " on a null object should do nothing."
-                        + " Instead we get: " + e.toString());
-            }
-            tx.commit();
-
-            logger.debug(" \nPASSED in executeNullObjectParameter() on " 
-                    + method);
-        } finally {
-            if (tx.isActive())
-                tx.rollback();
-        }        
-
-    }
-
-    /** 
-     * Test that the method under test with null valued Collection argument
-     * throws NullPointerException.
-     */
-    public void executeNullCollectionParameter(MethodUnderTest mut,
-            String method) {
-
-        Collection coll = null;
-        Transaction tx = pm.currentTransaction();
-
-        try {
-            tx.begin();
-            try {
-                mut.pmApi(pm, coll);
-                fail(ASSERTION4_FAILED,
-                        method
-                        + " with null Collection argument should throw NPE.");
-            } catch (NullPointerException npe) {
-                // this is what we want
-            } catch (Exception e) {
-                fail(ASSERTION4_FAILED,
-                        method 
-                        + " with null Collection argument should throw NPE."
-                        + " Instead we get: " + e.toString());
-                e.printStackTrace();
-            }
-            tx.commit();
-
-            logger.debug(" \nPASSED in executeNullCollectionParameter()");
-        } finally {
-            if (tx.isActive())
-                tx.rollback();
-        }        
-
-    }
-
-    /** 
-     * Test that the method under test with null valued array argument
-     * throws NullPointerException.
-     */
-    public void executeNullArrayParameter(MethodUnderTest mut,
-                String method) {
-
-        Object[] array = null; 
-        Transaction tx = pm.currentTransaction();
-
-        try {
-            tx.begin();
-            try {
-                mut.pmApi(pm, array);
-                fail(ASSERTION4_FAILED, method +
-                        " with null array argument should throw NPE.");
-            } catch (NullPointerException npe) {
-                // this is what we want
-            } catch (Exception e) {
-                fail(ASSERTION4_FAILED,
-                        method + " with null array argument should throw NPE."
-                        + " Instead we get: " + e.toString());
-                e.printStackTrace();
-            }
-            tx.commit();
-
-            logger.debug(" \nPASSED in executeNullArrayParameter()");
-        } finally {
-            if (tx.isActive())
-                tx.rollback();
-        }        
-
-    }
-
-    /** 
-     * Test that the method under test with a null element of a 
-     * Collection argument ignores the null element.
-     */
-    public void executeCollectionNullElement(Collection coll,
-            MethodUnderTest mut, String method) {
-
-        Transaction tx = pm.currentTransaction();
-        try {
-            tx = pm.currentTransaction();
-
-            tx.begin();
-            try {
-                mut.pmApi(pm, coll);
-            } catch (Exception e) {
-                fail(ASSERTION5_FAILED,
-                        method + " on a null Collection element should"
-                        + " do nothing. Instead we get: " + e.toString());
-                e.printStackTrace();
-            }
-
-            tx.commit();
-        } finally {
-            if (tx.isActive())
-                tx.rollback();
-        }        
-
-    }
-
-    /** 
-     * Test that the method under test with a null element of a 
-     * array argument ignores the null element.
-     */
-    public void executeArrayNullElement(Object[] array, MethodUnderTest mut,
-                String method) {
-
-        Transaction tx = pm.currentTransaction();
-        try {
-            tx = pm.currentTransaction();
-
-            tx.begin();
-            try {
-                mut.pmApi(pm, array);
-            } catch (Exception e) {
-                fail(ASSERTION5_FAILED,
-                        method + " on a null array element should " 
-                        + "do nothing. Instead we get: " + e.toString());
-                e.printStackTrace();
-            }
-
-            tx.commit();
-
-        } finally {
-            if (tx.isActive())
-                tx.rollback();
-        }
-
-    }
-
-    /** 
-     * Test that method under test with null valued argument does nothing.
-     */
-    public void executeNullObjectParameterReturn(MethodUnderTest mut, 
-            String method) {
-
-        Object returnVal = null;
-        Object obj = null;
-        Transaction tx = pm.currentTransaction();
-        try {
-            tx = pm.currentTransaction();
-
-            tx.begin();
-            try {
-                returnVal = mut.pmApiReturn(pm, obj);
-            } catch (Exception e) {
-                fail(ASSERTION3_FAILED,
-                        method + " on a null object should do nothing."
-                        + " Instead we get: " + e.toString());
-                e.printStackTrace();
-            }
-            if (returnVal != null)
-                fail(ASSERTION3_FAILED,
-                        method + " returns non-null Object; expected null.");
-
-            tx.commit();
-
-            logger.debug(" \nPASSED in executeNullObjectParameter() on " 
-                    + method);
-        }
-        finally {
-            if (tx.isActive())
-                tx.rollback();
-        }        
-
-    }
-
-    /** 
-     * Test that the method under test with null valued Collection argument
-     * throws NullPointerException.
-     */
-    public void executeNullCollectionParameterReturn( MethodUnderTest mut, 
-            String method) {
-
-        Collection returnVal = null;
-        Collection coll = null;
-        Transaction tx = pm.currentTransaction();
-
-        try {
-            tx.begin();
-            try {
-                returnVal = mut.pmApiReturn(pm, coll);
-                fail(ASSERTION4_FAILED,
-                        method
-                        + " with null Collection argument should throw NPE.");
-            } catch (NullPointerException npe) {
-                // this is what we want
-            } catch (Exception e) {
-                fail(ASSERTION4_FAILED,
-                        method 
-                        + " with null Collection argument should throw NPE."
-                        + " Instead we get: " + e.toString());
-                e.printStackTrace();
-            }
-            if (returnVal != null)
-                fail(ASSERTION4_FAILED,
-                        method + " returns non-null Object. ");
-            tx.commit();
-
-            logger.debug(" \nPASSED in executeNullCollectionParameter()");
-            }
-        finally {
-            if (tx.isActive())
-                tx.rollback();
-        }        
-
-    }
-
-    /** 
-     * Test that the method under test with null valued array argument
-     * throws NullPointerException.
-     */
-    public void executeNullArrayParameterReturn(MethodUnderTest mut, 
-            String method) {
-
-        Object[] returnVal = null;
-        Object[] array = null;
-        Transaction tx = pm.currentTransaction();
-
-        try {
-            tx.begin();
-            try {
-                returnVal = mut.pmApiReturn(pm, array);
-                fail(ASSERTION4_FAILED, method 
-                        + " with null array argument should throw NPE.");
-            } catch (NullPointerException npe) {
-                // this is what we want
-            } catch (Exception e) {
-                fail(ASSERTION4_FAILED,
-                        method + " with null array argument should throw NPE."
-                        + " Instead we get: " + e.toString());
-                e.printStackTrace();
-            }
-            if (returnVal != null)
-                fail(ASSERTION4_FAILED,
-                        method + " returns non-null Object.");
-            tx.commit();
-
-            logger.debug(" \nPASSED in executeNullArrayParameter()");
-        }
-        finally {
-            if (tx.isActive())
-                tx.rollback();
-        }        
-
-    }
-
-    /** 
-     * Test that the method under test with a null element of a 
-     * Collection argument ignores the null element.
-     */
-    public void executeCollectionNullElementReturn(Collection coll,
-            MethodUnderTest mut, String method) {
-
-        Collection returnVal = null;
-        Transaction tx = pm.currentTransaction();
-        try {
-            tx = pm.currentTransaction();
-
-            tx.begin();
-            try {
-                returnVal = mut.pmApiReturn(pm, coll);
-            } catch (Exception e) {
-                fail(ASSERTION5_FAILED,
-                        method + " on a null Collection element should"
-                        + " do nothing. Instead we get: " + e.toString());
-                e.printStackTrace();
-            }
-
-            if (!checkReturn(expectedCollection, returnVal))
-                fail(ASSERTION5_FAILED,
-                        method + " returns incorrect Object. Expected "
-                        + expectedCollection.toString() + " actual was " 
-                        + returnVal.toString());
-            tx.commit();
-        } finally {
-            if (tx.isActive())
-                tx.rollback();
-        }        
-
-    }
-
-    /** 
-     * Test that the method under test with a null element of a 
-     * array argument ignores the null element.
-     */
-    public void executeArrayNullElementReturn(Object[] obj,
-            MethodUnderTest mut, String method) {
-
-        Object[] returnVal = null;
-        Transaction tx = pm.currentTransaction();
-        try {
-            tx = pm.currentTransaction();
-
-            tx.begin();
-            try {
-                returnVal = mut.pmApiReturn(pm, obj);
-            } catch (Exception e) {
-                fail(ASSERTION5_FAILED,
-                        method + " on a null array element should " 
-                        + "do nothing. Instead we get: " + e.toString());
-                e.printStackTrace();
-            }
-
-            if (!checkReturn(expectedArray, returnVal))
-                fail(ASSERTION5_FAILED,
-                        method + " returns incorrect Object. Expected "
-                        + Arrays.asList(expectedArray).toString() 
-                        + " actual was " 
-                        + Arrays.asList(returnVal).toString());
-            tx.commit();
-
-        } finally {
-            if (tx.isActive())
-                tx.rollback();
-        }
-
-    }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager.nullargs;
+
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+
+/**
+  * The superclass for the tests of null arguments to pm methods.
+  *
+  * Null arguments to APIs that take an Object parameter cause the API 
+  * to have no effect. Null arguments to APIs that take Object[] or Collection
+  * will cause the API to throw NullPointerException. Non-null Object[] or 
+  * Collection arguments that contain null elements will have the documented 
+  * behavior for non-null elements, and the null elements will be ignored.
+  *
+  */
+
+public class PersistenceManagerNullsTest extends JDO_Test {
+
+    /**
+    public static interface MethodUnderTest {
+        public void pmApi(PersistenceManager pm, Object obj);
+        public void pmApi(PersistenceManager pm, Collection coll);
+        public void pmApi(PersistenceManager pm, Object[] objs);
+        public Object pmApiReturn(PersistenceManager pm, Object obj);
+        public Collection pmApiReturn(PersistenceManager pm,  Collection coll);
+        public Object[] pmApiReturn(PersistenceManager pm, Object [ ] objs);
+    }
+     */
+
+    /**
+     */
+    public static class MethodUnderTest {
+        public void pmApi(PersistenceManager pm, Object obj) {
+            throw new UnsupportedOperationException("Test must implement this method");
+        }
+        public void pmApi(PersistenceManager pm, Collection coll) {
+            throw new UnsupportedOperationException("Test must implement this method");
+        }
+        public void pmApi(PersistenceManager pm, Object[] objs) {
+            throw new UnsupportedOperationException("Test must implement this method");
+        }
+        public Object pmApiReturn(PersistenceManager pm, Object obj) {
+            throw new UnsupportedOperationException("Test must implement this method");
+        }
+        public Collection pmApiReturn(PersistenceManager pm, Collection coll) {
+            throw new UnsupportedOperationException("Test must implement this method");
+        }
+        public Object[] pmApiReturn(PersistenceManager pm, Object[] objs) {
+            throw new UnsupportedOperationException("Test must implement this method");
+        }
+    } 
+
+
+    private static final String ASSERTION3_FAILED = 
+        "Assertion A12.6-3 failed: ";
+    
+    private static final String ASSERTION4_FAILED = 
+        "Assertion A12.6-4 failed: ";
+    
+    private static final String ASSERTION5_FAILED = 
+        "Assertion A12.6-5 failed: ";
+
+    protected PCPoint pNotNull = null;
+    protected Collection collNullElem = null;
+    protected Collection expectedCollection = null;
+    protected Object[] arrayNullElem = new Object[] {null, null};
+    protected Object[] expectedArray = new Object[] {null, null};
+    protected Collection testInstances = null;
+    
+    /** */
+    protected PersistenceManagerNullsTest() { }
+
+    /** 
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        // The order of addTearDownClass calls is significant
+        // as it takes into account database FKs.
+        addTearDownClass(PCPoint.class);
+
+        // Initialize test objects and expected values
+        pNotNull = new PCPoint(3, 5);
+        arrayNullElem[1] = pNotNull;
+        expectedArray[1] = pNotNull;
+        collNullElem = Arrays.asList(arrayNullElem);
+
+        pm = getPM();   
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+
+            tx.begin();
+            try {
+                pm.makePersistent(pNotNull);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            tx.commit();
+
+            logger.debug(" \nSetup committed in DeletePersistentNullArgs()");
+        }
+        finally {
+            if (tx.isActive()) {
+                tx.rollback();
+            }
+        }       expectedCollection = Arrays.asList(arrayNullElem);
+
+    }
+    
+    protected static String toString(Object[] objs) {
+        StringBuffer out = new StringBuffer();
+        for (int i=0; i < objs.length; i++) {
+            out.append("[" + i + "]: ");
+            if (objs[i] == null)
+                out.append("null");
+            else out.append(objs[i].toString());
+            out.append(",  ");
+        }
+        return out.toString();
+    }
+
+    protected static String toString(Collection objs) {
+        return toString(objs.toArray());
+    }
+
+    /**
+      * Checks if expected and actual arguments match for null/non-null value
+      * @return true if arguments match
+      * @param expected Collection
+      * @param actual Collection
+      */
+    protected boolean checkReturn(Collection expected, Collection actual) {
+        Object eElem = null;
+        Object aElem = null;
+        if (expected.size() != actual.size())
+            return false;
+        Iterator eIt = expected.iterator();
+        Iterator aIt = actual.iterator();
+        while (eIt.hasNext()) {
+            eElem = eIt.next();
+            aElem = aIt.next();
+            if ( (eElem == null && aElem != null)
+               || (aElem == null && eElem != null) )
+                return false;
+        }
+        return true;
+    }
+
+    /**
+      * Checks if expected and actual arguments match for null/non-null value
+      * @return true if arguments match
+      * @param expected Object[]
+      * @param actual Object[]
+      */
+    protected boolean checkReturn(Object[] expected, Object[] actual) {
+        Object eElem = null;
+        Object aElem = null;
+        if (expected.length != actual.length)
+            return false;
+        for (int i=0; i < expected.length; i++) {
+            eElem = expected[i];
+            aElem = actual[i];
+            if ( (eElem == null && aElem != null)
+               || (aElem == null && eElem != null) )
+                return false;
+        }
+        return true;
+    }
+
+    /** 
+     * Test that method under test with null valued argument does nothing.
+     */
+    public void executeNullObjectParameter(MethodUnderTest mut, String method) {
+
+        Transaction tx = pm.currentTransaction();
+        Object obj = null;
+        try {
+            tx = pm.currentTransaction();
+
+            tx.begin();
+            try {
+                mut.pmApi(pm, obj);
+            } catch (Exception e) {
+                fail(ASSERTION3_FAILED,
+                        method + " on a null object should do nothing."
+                        + " Instead we get: " + e.toString());
+            }
+            tx.commit();
+
+            logger.debug(" \nPASSED in executeNullObjectParameter() on " 
+                    + method);
+        } finally {
+            if (tx.isActive())
+                tx.rollback();
+        }        
+
+    }
+
+    /** 
+     * Test that the method under test with null valued Collection argument
+     * throws NullPointerException.
+     */
+    public void executeNullCollectionParameter(MethodUnderTest mut,
+            String method) {
+
+        Collection coll = null;
+        Transaction tx = pm.currentTransaction();
+
+        try {
+            tx.begin();
+            try {
+                mut.pmApi(pm, coll);
+                fail(ASSERTION4_FAILED,
+                        method
+                        + " with null Collection argument should throw NPE.");
+            } catch (NullPointerException npe) {
+                // this is what we want
+            } catch (Exception e) {
+                fail(ASSERTION4_FAILED,
+                        method 
+                        + " with null Collection argument should throw NPE."
+                        + " Instead we get: " + e.toString());
+                e.printStackTrace();
+            }
+            tx.commit();
+
+            logger.debug(" \nPASSED in executeNullCollectionParameter()");
+        } finally {
+            if (tx.isActive())
+                tx.rollback();
+        }        
+
+    }
+
+    /** 
+     * Test that the method under test with null valued array argument
+     * throws NullPointerException.
+     */
+    public void executeNullArrayParameter(MethodUnderTest mut,
+                String method) {
+
+        Object[] array = null; 
+        Transaction tx = pm.currentTransaction();
+
+        try {
+            tx.begin();
+            try {
+                mut.pmApi(pm, array);
+                fail(ASSERTION4_FAILED, method +
+                        " with null array argument should throw NPE.");
+            } catch (NullPointerException npe) {
+                // this is what we want
+            } catch (Exception e) {
+                fail(ASSERTION4_FAILED,
+                        method + " with null array argument should throw NPE."
+                        + " Instead we get: " + e.toString());
+                e.printStackTrace();
+            }
+            tx.commit();
+
+            logger.debug(" \nPASSED in executeNullArrayParameter()");
+        } finally {
+            if (tx.isActive())
+                tx.rollback();
+        }        
+
+    }
+
+    /** 
+     * Test that the method under test with a null element of a 
+     * Collection argument ignores the null element.
+     */
+    public void executeCollectionNullElement(Collection coll,
+            MethodUnderTest mut, String method) {
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+
+            tx.begin();
+            try {
+                mut.pmApi(pm, coll);
+            } catch (Exception e) {
+                fail(ASSERTION5_FAILED,
+                        method + " on a null Collection element should"
+                        + " do nothing. Instead we get: " + e.toString());
+                e.printStackTrace();
+            }
+
+            tx.commit();
+        } finally {
+            if (tx.isActive())
+                tx.rollback();
+        }        
+
+    }
+
+    /** 
+     * Test that the method under test with a null element of a 
+     * array argument ignores the null element.
+     */
+    public void executeArrayNullElement(Object[] array, MethodUnderTest mut,
+                String method) {
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+
+            tx.begin();
+            try {
+                mut.pmApi(pm, array);
+            } catch (Exception e) {
+                fail(ASSERTION5_FAILED,
+                        method + " on a null array element should " 
+                        + "do nothing. Instead we get: " + e.toString());
+                e.printStackTrace();
+            }
+
+            tx.commit();
+
+        } finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+
+    }
+
+    /** 
+     * Test that method under test with null valued argument does nothing.
+     */
+    public void executeNullObjectParameterReturn(MethodUnderTest mut, 
+            String method) {
+
+        Object returnVal = null;
+        Object obj = null;
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+
+            tx.begin();
+            try {
+                returnVal = mut.pmApiReturn(pm, obj);
+            } catch (Exception e) {
+                fail(ASSERTION3_FAILED,
+                        method + " on a null object should do nothing."
+                        + " Instead we get: " + e.toString());
+                e.printStackTrace();
+            }
+            if (returnVal != null)
+                fail(ASSERTION3_FAILED,
+                        method + " returns non-null Object; expected null.");
+
+            tx.commit();
+
+            logger.debug(" \nPASSED in executeNullObjectParameter() on " 
+                    + method);
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }        
+
+    }
+
+    /** 
+     * Test that the method under test with null valued Collection argument
+     * throws NullPointerException.
+     */
+    public void executeNullCollectionParameterReturn( MethodUnderTest mut, 
+            String method) {
+
+        Collection returnVal = null;
+        Collection coll = null;
+        Transaction tx = pm.currentTransaction();
+
+        try {
+            tx.begin();
+            try {
+                returnVal = mut.pmApiReturn(pm, coll);
+                fail(ASSERTION4_FAILED,
+                        method
+                        + " with null Collection argument should throw NPE.");
+            } catch (NullPointerException npe) {
+                // this is what we want
+            } catch (Exception e) {
+                fail(ASSERTION4_FAILED,
+                        method 
+                        + " with null Collection argument should throw NPE."
+                        + " Instead we get: " + e.toString());
+                e.printStackTrace();
+            }
+            if (returnVal != null)
+                fail(ASSERTION4_FAILED,
+                        method + " returns non-null Object. ");
+            tx.commit();
+
+            logger.debug(" \nPASSED in executeNullCollectionParameter()");
+            }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }        
+
+    }
+
+    /** 
+     * Test that the method under test with null valued array argument
+     * throws NullPointerException.
+     */
+    public void executeNullArrayParameterReturn(MethodUnderTest mut, 
+            String method) {
+
+        Object[] returnVal = null;
+        Object[] array = null;
+        Transaction tx = pm.currentTransaction();
+
+        try {
+            tx.begin();
+            try {
+                returnVal = mut.pmApiReturn(pm, array);
+                fail(ASSERTION4_FAILED, method 
+                        + " with null array argument should throw NPE.");
+            } catch (NullPointerException npe) {
+                // this is what we want
+            } catch (Exception e) {
+                fail(ASSERTION4_FAILED,
+                        method + " with null array argument should throw NPE."
+                        + " Instead we get: " + e.toString());
+                e.printStackTrace();
+            }
+            if (returnVal != null)
+                fail(ASSERTION4_FAILED,
+                        method + " returns non-null Object.");
+            tx.commit();
+
+            logger.debug(" \nPASSED in executeNullArrayParameter()");
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }        
+
+    }
+
+    /** 
+     * Test that the method under test with a null element of a 
+     * Collection argument ignores the null element.
+     */
+    public void executeCollectionNullElementReturn(Collection coll,
+            MethodUnderTest mut, String method) {
+
+        Collection returnVal = null;
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+
+            tx.begin();
+            try {
+                returnVal = mut.pmApiReturn(pm, coll);
+            } catch (Exception e) {
+                fail(ASSERTION5_FAILED,
+                        method + " on a null Collection element should"
+                        + " do nothing. Instead we get: " + e.toString());
+                e.printStackTrace();
+            }
+
+            if (!checkReturn(expectedCollection, returnVal))
+                fail(ASSERTION5_FAILED,
+                        method + " returns incorrect Object. Expected "
+                        + expectedCollection.toString() + " actual was " 
+                        + returnVal.toString());
+            tx.commit();
+        } finally {
+            if (tx.isActive())
+                tx.rollback();
+        }        
+
+    }
+
+    /** 
+     * Test that the method under test with a null element of a 
+     * array argument ignores the null element.
+     */
+    public void executeArrayNullElementReturn(Object[] obj,
+            MethodUnderTest mut, String method) {
+
+        Object[] returnVal = null;
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+
+            tx.begin();
+            try {
+                returnVal = mut.pmApiReturn(pm, obj);
+            } catch (Exception e) {
+                fail(ASSERTION5_FAILED,
+                        method + " on a null array element should " 
+                        + "do nothing. Instead we get: " + e.toString());
+                e.printStackTrace();
+            }
+
+            if (!checkReturn(expectedArray, returnVal))
+                fail(ASSERTION5_FAILED,
+                        method + " returns incorrect Object. Expected "
+                        + Arrays.asList(expectedArray).toString() 
+                        + " actual was " 
+                        + Arrays.asList(returnVal).toString());
+            tx.commit();
+
+        } finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+
+    }
+}

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RefreshNullArgs.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RefreshNullArgs.java?view=diff&rev=491121&r1=491120&r2=491121
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RefreshNullArgs.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RefreshNullArgs.java Fri Dec 29 14:18:40 2006
@@ -1,108 +1,108 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- * 
- * 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 
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-
-
-package org.apache.jdo.tck.api.persistencemanager.nullargs;
-
-import java.util.Collection;
-
-import javax.jdo.JDOUserException;
-import javax.jdo.PersistenceManager;
-import javax.jdo.Transaction;
-
-import org.apache.jdo.tck.pc.mylib.PCPoint;
-import org.apache.jdo.tck.util.BatchTestRunner;
-
-/**
- *<B>Title:</B> refresh with Null Arguments
- *<BR>
- *<B>Keywords:</B>
- *<BR>
- *<B>Assertion IDs:</B> A12.6.3, A12.6.4, A12.6.5
- *<BR>
- *<B>Assertion Description: </B>
-A12.6-3 [Null arguments to APIs that take an Object parameter cause the API to have no effect.] A12.6-4 [Null arguments to APIs that take Object[] or Collection will cause the API to throw NullPointerException.] A12.6-5 [Non-null Object[] or Collection arguments that contain null elements will have the documented behavior for non-null elements, and the null elements will be ignored.]
- */
-
-public class RefreshNullArgs extends PersistenceManagerNullsTest {
-    
-    /**
-     * The <code>main</code> 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(RefreshNullArgs.class);
-    }
-
-    static MethodUnderTest refresh = 
-            new MethodUnderTestRefresh();
-    static class MethodUnderTestRefresh extends MethodUnderTest {
-        public void pmApi(PersistenceManager pm, Object pc) {
-            pm.refresh(pc);
-        }
-        public void pmApi(PersistenceManager pm, Collection pcs) {
-            pm.refreshAll(pcs);
-        }
-        public void pmApi(PersistenceManager pm, Object[] pcs) {
-            pm.refreshAll(pcs);
-        }
-    };
-
-    /** 
-     * Test that refresh() with null valued argument does nothing.
-     */
-    public void testRefreshNullObject() {
-        executeNullObjectParameter(refresh, "refresh(null)");
-    }
-
-    /** 
-     * Test that refreshAll() with null valued Collection argument
-     * throws NullPointerException.
-     */
-    public void testRefreshNullCollection() {
-        executeNullCollectionParameter(refresh,
-                "refreshAll((Collection)null)");
-    }
-
-    /** 
-     * Test that refreshAll() with null valued array argument
-     * throws NullPointerException.
-     */
-    public void testRefreshNullArray() {
-        executeNullArrayParameter(refresh, 
-                "refreshAll((Object[])null)");
-    }
-
-    /** 
-     * Test that refreshAll() with a null element of a 
-     * Collection argument throws NullPointerException.
-     */
-    public void testRefreshCollectionNullElement() {
-        executeCollectionNullElement(collNullElem, refresh, 
-                "refreshAll(Collection)");
-    }
-
-    /** 
-     * Test that refreshAll() with a null element of a 
-     * array argument throws NullPointerException.
-     */
-    public void testRefreshArrayNullElement() {
-        executeArrayNullElement(arrayNullElem, refresh, 
-                "refreshAll(Object[])");
-    }
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager.nullargs;
+
+import java.util.Collection;
+
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> refresh with Null Arguments
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.6.3, A12.6.4, A12.6.5
+ *<BR>
+ *<B>Assertion Description: </B>
+A12.6-3 [Null arguments to APIs that take an Object parameter cause the API to have no effect.] A12.6-4 [Null arguments to APIs that take Object[] or Collection will cause the API to throw NullPointerException.] A12.6-5 [Non-null Object[] or Collection arguments that contain null elements will have the documented behavior for non-null elements, and the null elements will be ignored.]
+ */
+
+public class RefreshNullArgs extends PersistenceManagerNullsTest {
+    
+    /**
+     * The <code>main</code> 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(RefreshNullArgs.class);
+    }
+
+    static MethodUnderTest refresh = 
+            new MethodUnderTestRefresh();
+    static class MethodUnderTestRefresh extends MethodUnderTest {
+        public void pmApi(PersistenceManager pm, Object pc) {
+            pm.refresh(pc);
+        }
+        public void pmApi(PersistenceManager pm, Collection pcs) {
+            pm.refreshAll(pcs);
+        }
+        public void pmApi(PersistenceManager pm, Object[] pcs) {
+            pm.refreshAll(pcs);
+        }
+    };
+
+    /** 
+     * Test that refresh() with null valued argument does nothing.
+     */
+    public void testRefreshNullObject() {
+        executeNullObjectParameter(refresh, "refresh(null)");
+    }
+
+    /** 
+     * Test that refreshAll() with null valued Collection argument
+     * throws NullPointerException.
+     */
+    public void testRefreshNullCollection() {
+        executeNullCollectionParameter(refresh,
+                "refreshAll((Collection)null)");
+    }
+
+    /** 
+     * Test that refreshAll() with null valued array argument
+     * throws NullPointerException.
+     */
+    public void testRefreshNullArray() {
+        executeNullArrayParameter(refresh, 
+                "refreshAll((Object[])null)");
+    }
+
+    /** 
+     * Test that refreshAll() with a null element of a 
+     * Collection argument throws NullPointerException.
+     */
+    public void testRefreshCollectionNullElement() {
+        executeCollectionNullElement(collNullElem, refresh, 
+                "refreshAll(Collection)");
+    }
+
+    /** 
+     * Test that refreshAll() with a null element of a 
+     * array argument throws NullPointerException.
+     */
+    public void testRefreshArrayNullElement() {
+        executeArrayNullElement(arrayNullElem, refresh, 
+                "refreshAll(Object[])");
+    }
+
+}

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RetrieveNullArgs.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RetrieveNullArgs.java?view=diff&rev=491121&r1=491120&r2=491121
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RetrieveNullArgs.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RetrieveNullArgs.java Fri Dec 29 14:18:40 2006
@@ -1,108 +1,108 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- * 
- * 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 
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-
-
-package org.apache.jdo.tck.api.persistencemanager.nullargs;
-
-import java.util.Collection;
-
-import javax.jdo.JDOUserException;
-import javax.jdo.PersistenceManager;
-import javax.jdo.Transaction;
-
-import org.apache.jdo.tck.pc.mylib.PCPoint;
-import org.apache.jdo.tck.util.BatchTestRunner;
-
-/**
- *<B>Title:</B> retrieve with Null Arguments
- *<BR>
- *<B>Keywords:</B>
- *<BR>
- *<B>Assertion IDs:</B> A12.6.3, A12.6.4, A12.6.5
- *<BR>
- *<B>Assertion Description: </B>
-A12.6-3 [Null arguments to APIs that take an Object parameter cause the API to have no effect.] A12.6-4 [Null arguments to APIs that take Object[] or Collection will cause the API to throw NullPointerException.] A12.6-5 [Non-null Object[] or Collection arguments that contain null elements will have the documented behavior for non-null elements, and the null elements will be ignored.]
- */
-
-public class RetrieveNullArgs extends PersistenceManagerNullsTest {
-    
-    /**
-     * The <code>main</code> 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(RetrieveNullArgs.class);
-    }
-
-    static MethodUnderTest retrieve = 
-            new MethodUnderTestRetrieve();
-    static class MethodUnderTestRetrieve extends MethodUnderTest {
-        public void pmApi(PersistenceManager pm, Object pc) {
-            pm.retrieve(pc);
-        }
-        public void pmApi(PersistenceManager pm, Collection pcs) {
-            pm.retrieveAll(pcs);
-        }
-        public void pmApi(PersistenceManager pm, Object[] pcs) {
-            pm.retrieveAll(pcs);
-        }
-    };
-
-    /** 
-     * Test that retrieve() with null valued argument does nothing.
-     */
-    public void testRetrieveNullObject() {
-        executeNullObjectParameter(retrieve, "retrieve(null)");
-    }
-
-    /** 
-     * Test that retrieveAll() with null valued Collection argument
-     * throws NullPointerException.
-     */
-    public void testRetrieveNullCollection() {
-        executeNullCollectionParameter(retrieve,
-                "retrieveAll((Collection)null)");
-    }
-
-    /** 
-     * Test that retrieveAll() with null valued array argument
-     * throws NullPointerException.
-     */
-    public void testRetrieveNullArray() {
-        executeNullArrayParameter(retrieve, 
-                "retrieveAll((Object[])null)");
-    }
-
-    /** 
-     * Test that retrieveAll() with a null element of a 
-     * Collection argument throws NullPointerException.
-     */
-    public void testRetrieveCollectionNullElement() {
-        executeCollectionNullElement(collNullElem, retrieve, 
-                "retrieveAll(Collection)");
-    }
-
-    /** 
-     * Test that retrieveAll() with a null element of a 
-     * array argument throws NullPointerException.
-     */
-    public void testRetrieveArrayNullElement() {
-        executeArrayNullElement(arrayNullElem, retrieve, 
-                "retrieveAll(Object[])");
-    }
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager.nullargs;
+
+import java.util.Collection;
+
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> retrieve with Null Arguments
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.6.3, A12.6.4, A12.6.5
+ *<BR>
+ *<B>Assertion Description: </B>
+A12.6-3 [Null arguments to APIs that take an Object parameter cause the API to have no effect.] A12.6-4 [Null arguments to APIs that take Object[] or Collection will cause the API to throw NullPointerException.] A12.6-5 [Non-null Object[] or Collection arguments that contain null elements will have the documented behavior for non-null elements, and the null elements will be ignored.]
+ */
+
+public class RetrieveNullArgs extends PersistenceManagerNullsTest {
+    
+    /**
+     * The <code>main</code> 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(RetrieveNullArgs.class);
+    }
+
+    static MethodUnderTest retrieve = 
+            new MethodUnderTestRetrieve();
+    static class MethodUnderTestRetrieve extends MethodUnderTest {
+        public void pmApi(PersistenceManager pm, Object pc) {
+            pm.retrieve(pc);
+        }
+        public void pmApi(PersistenceManager pm, Collection pcs) {
+            pm.retrieveAll(pcs);
+        }
+        public void pmApi(PersistenceManager pm, Object[] pcs) {
+            pm.retrieveAll(pcs);
+        }
+    };
+
+    /** 
+     * Test that retrieve() with null valued argument does nothing.
+     */
+    public void testRetrieveNullObject() {
+        executeNullObjectParameter(retrieve, "retrieve(null)");
+    }
+
+    /** 
+     * Test that retrieveAll() with null valued Collection argument
+     * throws NullPointerException.
+     */
+    public void testRetrieveNullCollection() {
+        executeNullCollectionParameter(retrieve,
+                "retrieveAll((Collection)null)");
+    }
+
+    /** 
+     * Test that retrieveAll() with null valued array argument
+     * throws NullPointerException.
+     */
+    public void testRetrieveNullArray() {
+        executeNullArrayParameter(retrieve, 
+                "retrieveAll((Object[])null)");
+    }
+
+    /** 
+     * Test that retrieveAll() with a null element of a 
+     * Collection argument throws NullPointerException.
+     */
+    public void testRetrieveCollectionNullElement() {
+        executeCollectionNullElement(collNullElem, retrieve, 
+                "retrieveAll(Collection)");
+    }
+
+    /** 
+     * Test that retrieveAll() with a null element of a 
+     * array argument throws NullPointerException.
+     */
+    public void testRetrieveArrayNullElement() {
+        executeArrayNullElement(arrayNullElem, retrieve, 
+                "retrieveAll(Object[])");
+    }
+
+}

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RetrieveWithFetchPlanNullArgs.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RetrieveWithFetchPlanNullArgs.java?view=diff&rev=491121&r1=491120&r2=491121
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RetrieveWithFetchPlanNullArgs.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/nullargs/RetrieveWithFetchPlanNullArgs.java Fri Dec 29 14:18:40 2006
@@ -1,108 +1,108 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- * 
- * 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 
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-
-
-package org.apache.jdo.tck.api.persistencemanager.nullargs;
-
-import java.util.Collection;
-
-import javax.jdo.JDOUserException;
-import javax.jdo.PersistenceManager;
-import javax.jdo.Transaction;
-
-import org.apache.jdo.tck.pc.mylib.PCPoint;
-import org.apache.jdo.tck.util.BatchTestRunner;
-
-/**
- *<B>Title:</B> retrieveWithFetchPlan with Null Arguments
- *<BR>
- *<B>Keywords:</B>
- *<BR>
- *<B>Assertion IDs:</B> A12.6.3, A12.6.4, A12.6.5
- *<BR>
- *<B>Assertion Description: </B>
-A12.6-3 [Null arguments to APIs that take an Object parameter cause the API to have no effect.] A12.6-4 [Null arguments to APIs that take Object[] or Collection will cause the API to throw NullPointerException.] A12.6-5 [Non-null Object[] or Collection arguments that contain null elements will have the documented behavior for non-null elements, and the null elements will be ignored.]
- */
-
-public class RetrieveWithFetchPlanNullArgs extends PersistenceManagerNullsTest {
-    
-    /**
-     * The <code>main</code> 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(RetrieveWithFetchPlanNullArgs.class);
-    }
-
-    static MethodUnderTest retrieveWithFetchPlan = 
-            new MethodUnderTestRetrieveWithFetchPlan();
-    static class MethodUnderTestRetrieveWithFetchPlan extends MethodUnderTest {
-        public void pmApi(PersistenceManager pm, Object pc) {
-            pm.retrieve(pc, false);
-        }
-        public void pmApi(PersistenceManager pm, Collection pcs) {
-            pm.retrieveAll(pcs, false);
-        }
-        public void pmApi(PersistenceManager pm, Object[] pcs) {
-            pm.retrieveAll(pcs, false);
-        }
-    };
-
-    /** 
-     * Test that retrieveWithFetchPlan() with null valued argument does nothing.
-     */
-    public void testRetrieveWithFetchPlanNullObject() {
-        executeNullObjectParameter(retrieveWithFetchPlan, "retrieveWithFetchPlan(null)");
-    }
-
-    /** 
-     * Test that retrieveWithFetchPlanAll() with null valued Collection argument
-     * throws NullPointerException.
-     */
-    public void testRetrieveWithFetchPlanNullCollection() {
-        executeNullCollectionParameter(retrieveWithFetchPlan,
-                "retrieveWithFetchPlanAll((Collection)null)");
-    }
-
-    /** 
-     * Test that retrieveWithFetchPlanAll() with null valued array argument
-     * throws NullPointerException.
-     */
-    public void testRetrieveWithFetchPlanNullArray() {
-        executeNullArrayParameter(retrieveWithFetchPlan, 
-                "retrieveWithFetchPlanAll((Object[])null)");
-    }
-
-    /** 
-     * Test that retrieveWithFetchPlanAll() with a null element of a 
-     * Collection argument throws NullPointerException.
-     */
-    public void testRetrieveWithFetchPlanCollectionNullElement() {
-        executeCollectionNullElement(collNullElem, retrieveWithFetchPlan, 
-                "retrieveWithFetchPlanAll(Collection)");
-    }
-
-    /** 
-     * Test that retrieveWithFetchPlanAll() with a null element of a 
-     * array argument throws NullPointerException.
-     */
-    public void testRetrieveWithFetchPlanArrayNullElement() {
-        executeArrayNullElement(arrayNullElem, retrieveWithFetchPlan, 
-                "retrieveWithFetchPlanAll(Object[])");
-    }
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager.nullargs;
+
+import java.util.Collection;
+
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> retrieveWithFetchPlan with Null Arguments
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.6.3, A12.6.4, A12.6.5
+ *<BR>
+ *<B>Assertion Description: </B>
+A12.6-3 [Null arguments to APIs that take an Object parameter cause the API to have no effect.] A12.6-4 [Null arguments to APIs that take Object[] or Collection will cause the API to throw NullPointerException.] A12.6-5 [Non-null Object[] or Collection arguments that contain null elements will have the documented behavior for non-null elements, and the null elements will be ignored.]
+ */
+
+public class RetrieveWithFetchPlanNullArgs extends PersistenceManagerNullsTest {
+    
+    /**
+     * The <code>main</code> 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(RetrieveWithFetchPlanNullArgs.class);
+    }
+
+    static MethodUnderTest retrieveWithFetchPlan = 
+            new MethodUnderTestRetrieveWithFetchPlan();
+    static class MethodUnderTestRetrieveWithFetchPlan extends MethodUnderTest {
+        public void pmApi(PersistenceManager pm, Object pc) {
+            pm.retrieve(pc, false);
+        }
+        public void pmApi(PersistenceManager pm, Collection pcs) {
+            pm.retrieveAll(pcs, false);
+        }
+        public void pmApi(PersistenceManager pm, Object[] pcs) {
+            pm.retrieveAll(pcs, false);
+        }
+    };
+
+    /** 
+     * Test that retrieveWithFetchPlan() with null valued argument does nothing.
+     */
+    public void testRetrieveWithFetchPlanNullObject() {
+        executeNullObjectParameter(retrieveWithFetchPlan, "retrieveWithFetchPlan(null)");
+    }
+
+    /** 
+     * Test that retrieveWithFetchPlanAll() with null valued Collection argument
+     * throws NullPointerException.
+     */
+    public void testRetrieveWithFetchPlanNullCollection() {
+        executeNullCollectionParameter(retrieveWithFetchPlan,
+                "retrieveWithFetchPlanAll((Collection)null)");
+    }
+
+    /** 
+     * Test that retrieveWithFetchPlanAll() with null valued array argument
+     * throws NullPointerException.
+     */
+    public void testRetrieveWithFetchPlanNullArray() {
+        executeNullArrayParameter(retrieveWithFetchPlan, 
+                "retrieveWithFetchPlanAll((Object[])null)");
+    }
+
+    /** 
+     * Test that retrieveWithFetchPlanAll() with a null element of a 
+     * Collection argument throws NullPointerException.
+     */
+    public void testRetrieveWithFetchPlanCollectionNullElement() {
+        executeCollectionNullElement(collNullElem, retrieveWithFetchPlan, 
+                "retrieveWithFetchPlanAll(Collection)");
+    }
+
+    /** 
+     * Test that retrieveWithFetchPlanAll() with a null element of a 
+     * array argument throws NullPointerException.
+     */
+    public void testRetrieveWithFetchPlanArrayNullElement() {
+        executeArrayNullElement(arrayNullElem, retrieveWithFetchPlan, 
+                "retrieveWithFetchPlanAll(Object[])");
+    }
+
+}

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/models/fieldtypes/TestArrayCollections.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/models/fieldtypes/TestArrayCollections.java?view=diff&rev=491121&r1=491120&r2=491121
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/models/fieldtypes/TestArrayCollections.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/models/fieldtypes/TestArrayCollections.java Fri Dec 29 14:18:40 2006
@@ -1,198 +1,198 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- * 
- * 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 
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
- 
-package org.apache.jdo.tck.models.fieldtypes;
-
-import java.lang.reflect.Array;
-
-import java.math.BigDecimal;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Vector;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.Transaction;
-
-import org.apache.jdo.tck.JDO_Test;
-import org.apache.jdo.tck.pc.fieldtypes.ArrayCollections;
-import org.apache.jdo.tck.pc.fieldtypes.SimpleClass;
-import org.apache.jdo.tck.util.BatchTestRunner;
-
-/**
- *<B>Title:</B> Support of field type array.
- *<BR>
- *<B>Keywords:</B> model
- *<BR>
- *<B>Assertion ID:</B> A6.4.3-39.
- *<BR>
- *<B>Assertion Description: </B>
-JDO implementations may optionally support fields of array types.
- */
-
-public class TestArrayCollections extends JDO_Test {
-
-    /** */
-    private static final String ASSERTION_FAILED = 
-        "Assertion (TestArrayCollections) failed: ";
-    
-    /**
-     * The <code>main</code> 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(TestArrayCollections.class);
-    }   
-
-    /**
-     * @see JDO_Test#localSetUp()
-     */
-    protected void localSetUp() {
-        addTearDownClass(ArrayCollections.class);
-        addTearDownClass(SimpleClass.class);
-    }
-    
-    /** */
-    public void test() {
-        pm = getPM();
-         
-        runTest(pm);
-        
-        pm.close();
-        pm = null;
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm) 
-    {
-        if (!isArraySupported()) {
-            if (debug)
-                logger.debug("JDO Implementation does not support" +
-                        "optional feature Array");
-            return;
-        }
-
-        Transaction tx = pm.currentTransaction();
-        ArrayCollections expectedValue = new ArrayCollections();
-
-            // turn on datastore transactions
-            tx.setOptimistic(false);
-            tx.begin();
-            ArrayCollections pi = new ArrayCollections();
-            pi.identifier = 1;
-            pm.makePersistent(pi);
-            Object oid = pm.getObjectId(pi);
-            // Provide initial set of values
-            setValues(pi, 1);
-
-            tx.commit();
-            // cache will be flushed
-            pi = null;
-            System.gc();
-
-            tx.begin();
-            setValues(expectedValue, 1);
-
-            // check if persistent fields have values set
-            checkValues(oid, expectedValue);
-            pi = (ArrayCollections) pm.getObjectById(oid, true);
-
-            // Provide new set of values
-            setValues(pi, 2);
-            tx.commit();
-            // cache will be flushed
-            pi = null;
-            System.gc();
-
-            tx.begin();
-            // check new values
-            setValues(expectedValue, 2);
-            checkValues(oid, expectedValue);
-            tx.commit();
-    }
-
-    /** */
-    private void setValues(ArrayCollections collect, int order)
-    {
-        Vector value;
-        Class vectorClass = null;
-        int n = collect.getLength();
-        for (int i = 0; i < n; ++i) {
-            String valueType = TestUtil.getFieldSpecs(
-                    ArrayCollections.fieldSpecs[i]);
-            value = TestUtil.makeNewVectorInstance(valueType, order);
-            try {
-                // get the right class to instantiate
-                vectorClass = value.get(0).getClass();
-            } catch (Exception e) {
-            }
-
-            Object[] valueArray = (Object[])Array.newInstance(vectorClass,
-                                     value.size());
-            value.toArray(valueArray);
-
-            collect.set(i, valueArray);
-            if (debug)
-                logger.debug("Set " + i + "th value to: "
-                        + valueArray.toString());
-        }
-    }
-
-    /** */
-    private void checkValues(Object oid, ArrayCollections expectedValue)
-    {
-        StringBuffer sbuf = new StringBuffer();
-        ArrayCollections pi = (ArrayCollections) pm.getObjectById(oid, true);
-        int n = pi.getLength();
-        for (int i = 0; i < n; ++i) {
-            Object obj = new Object();
-            Class objClass = obj.getClass();
-            Object[] expected = (Object[])Array.newInstance(objClass, 5);
-            Object[] actual = (Object[])Array.newInstance(objClass, 5);
-            expected = expectedValue.get(i);
-            actual = pi.get(i);
-            if (expected.length != actual.length) {
-                sbuf.append("\nFor element " + i + ", expected size = " +
-                        expected.length + ", actual size = " + actual.length
-                        + " . ");
-                continue;
-            }
-            else if (!Arrays.equals(expected, actual)) {
-                if (TestUtil.getFieldSpecs(ArrayCollections.fieldSpecs[i]
-                            ).equals("BigDecimal")) {
-                    for (int j = 0; j < actual.length; ++j) {
-                        BigDecimal expectedBD = (BigDecimal)expected[j];
-                        BigDecimal actualBD = (BigDecimal)actual[j];
-                        if ((expectedBD.compareTo(actualBD) != 0)) {
-                            sbuf.append("\nFor element " + i + "[" + j +
-                                    "], expected = " + expectedBD +
-                                    ", actual = " + actualBD + " . ");
-                        }
-                    }
-                }
-                else {
-                    sbuf.append("\nFor element " + i + ", expected = " +
-                        expected + ", actual = " + actual + " . ");
-                }
-            }
-        }
-        if (sbuf.length() > 0) {
-            fail(ASSERTION_FAILED,
-                 "Expected and observed do not match!!" + sbuf.toString());
-        }
-    }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.models.fieldtypes;
+
+import java.lang.reflect.Array;
+
+import java.math.BigDecimal;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Vector;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.ArrayCollections;
+import org.apache.jdo.tck.pc.fieldtypes.SimpleClass;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type array.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-39.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations may optionally support fields of array types.
+ */
+
+public class TestArrayCollections extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion (TestArrayCollections) failed: ";
+    
+    /**
+     * The <code>main</code> 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(TestArrayCollections.class);
+    }   
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        addTearDownClass(ArrayCollections.class);
+        addTearDownClass(SimpleClass.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+         
+        runTest(pm);
+        
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    void runTest(PersistenceManager pm) 
+    {
+        if (!isArraySupported()) {
+            if (debug)
+                logger.debug("JDO Implementation does not support" +
+                        "optional feature Array");
+            return;
+        }
+
+        Transaction tx = pm.currentTransaction();
+        ArrayCollections expectedValue = new ArrayCollections();
+
+            // turn on datastore transactions
+            tx.setOptimistic(false);
+            tx.begin();
+            ArrayCollections pi = new ArrayCollections();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            // Provide initial set of values
+            setValues(pi, 1);
+
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            setValues(expectedValue, 1);
+
+            // check if persistent fields have values set
+            checkValues(oid, expectedValue);
+            pi = (ArrayCollections) pm.getObjectById(oid, true);
+
+            // Provide new set of values
+            setValues(pi, 2);
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            setValues(expectedValue, 2);
+            checkValues(oid, expectedValue);
+            tx.commit();
+    }
+
+    /** */
+    private void setValues(ArrayCollections collect, int order)
+    {
+        Vector value;
+        Class vectorClass = null;
+        int n = collect.getLength();
+        for (int i = 0; i < n; ++i) {
+            String valueType = TestUtil.getFieldSpecs(
+                    ArrayCollections.fieldSpecs[i]);
+            value = TestUtil.makeNewVectorInstance(valueType, order);
+            try {
+                // get the right class to instantiate
+                vectorClass = value.get(0).getClass();
+            } catch (Exception e) {
+            }
+
+            Object[] valueArray = (Object[])Array.newInstance(vectorClass,
+                                     value.size());
+            value.toArray(valueArray);
+
+            collect.set(i, valueArray);
+            if (debug)
+                logger.debug("Set " + i + "th value to: "
+                        + valueArray.toString());
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, ArrayCollections expectedValue)
+    {
+        StringBuffer sbuf = new StringBuffer();
+        ArrayCollections pi = (ArrayCollections) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for (int i = 0; i < n; ++i) {
+            Object obj = new Object();
+            Class objClass = obj.getClass();
+            Object[] expected = (Object[])Array.newInstance(objClass, 5);
+            Object[] actual = (Object[])Array.newInstance(objClass, 5);
+            expected = expectedValue.get(i);
+            actual = pi.get(i);
+            if (expected.length != actual.length) {
+                sbuf.append("\nFor element " + i + ", expected size = " +
+                        expected.length + ", actual size = " + actual.length
+                        + " . ");
+                continue;
+            }
+            else if (!Arrays.equals(expected, actual)) {
+                if (TestUtil.getFieldSpecs(ArrayCollections.fieldSpecs[i]
+                            ).equals("BigDecimal")) {
+                    for (int j = 0; j < actual.length; ++j) {
+                        BigDecimal expectedBD = (BigDecimal)expected[j];
+                        BigDecimal actualBD = (BigDecimal)actual[j];
+                        if ((expectedBD.compareTo(actualBD) != 0)) {
+                            sbuf.append("\nFor element " + i + "[" + j +
+                                    "], expected = " + expectedBD +
+                                    ", actual = " + actualBD + " . ");
+                        }
+                    }
+                }
+                else {
+                    sbuf.append("\nFor element " + i + ", expected = " +
+                        expected + ", actual = " + actual + " . ");
+                }
+            }
+        }
+        if (sbuf.length() > 0) {
+            fail(ASSERTION_FAILED,
+                 "Expected and observed do not match!!" + sbuf.toString());
+        }
+    }
+}

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/shoppingcart/Undetachable.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/shoppingcart/Undetachable.java?view=diff&rev=491121&r1=491120&r2=491121
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/shoppingcart/Undetachable.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/shoppingcart/Undetachable.java Fri Dec 29 14:18:40 2006
@@ -1,92 +1,92 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- * 
- * 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 
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-package org.apache.jdo.tck.pc.shoppingcart;
-
-import java.io.Serializable;
-
-/**
- * This class is a token undetachable class. It is only present to be
- * persistence-capable but not detachable so as to test that a detachable class
- * must be declared so.
- */
-public class Undetachable implements Serializable {
-
-    protected static long nextId = System.currentTimeMillis();
-
-    public synchronized static long nextId() {
-        return nextId++;
-    }
-
-    /** Identity field for use with application identity */
-    protected long id;
-    protected int foo;
-    protected int bar;
-
-    public Undetachable() {
-        this(nextId());
-    }
-
-    public Undetachable(long id) {
-        this.id = id;
-    }
-
-    public static class Oid implements Serializable {
-        public long id;
-
-        public Oid() {
-        }
-
-        public Oid(String s) {
-            id = Long.parseLong(justTheId(s));
-        }
-
-        public String toString() {
-            return this.getClass().getName() + ":" + id;
-        }
-
-        public int hashCode() {
-            return (int) id;
-        }
-
-        public boolean equals(Object other) {
-            if (other != null && (other instanceof Oid)) {
-                Oid that = (Oid) other;
-                return that.id == this.id;
-            }
-            return false;
-        }
-
-        protected static String justTheId(String str) {
-            return str.substring(str.indexOf(':') + 1);
-        }
-    }
-
-    public int getFoo() {
-        return foo;
-    }
-
-    public void setFoo(int foo) {
-        this.foo = foo;
-    }
-
-    public int getBar() {
-        return bar;
-    }
-
-    public void setBar(int bar) {
-        this.bar = bar;
-    }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.jdo.tck.pc.shoppingcart;
+
+import java.io.Serializable;
+
+/**
+ * This class is a token undetachable class. It is only present to be
+ * persistence-capable but not detachable so as to test that a detachable class
+ * must be declared so.
+ */
+public class Undetachable implements Serializable {
+
+    protected static long nextId = System.currentTimeMillis();
+
+    public synchronized static long nextId() {
+        return nextId++;
+    }
+
+    /** Identity field for use with application identity */
+    protected long id;
+    protected int foo;
+    protected int bar;
+
+    public Undetachable() {
+        this(nextId());
+    }
+
+    public Undetachable(long id) {
+        this.id = id;
+    }
+
+    public static class Oid implements Serializable {
+        public long id;
+
+        public Oid() {
+        }
+
+        public Oid(String s) {
+            id = Long.parseLong(justTheId(s));
+        }
+
+        public String toString() {
+            return this.getClass().getName() + ":" + id;
+        }
+
+        public int hashCode() {
+            return (int) id;
+        }
+
+        public boolean equals(Object other) {
+            if (other != null && (other instanceof Oid)) {
+                Oid that = (Oid) other;
+                return that.id == this.id;
+            }
+            return false;
+        }
+
+        protected static String justTheId(String str) {
+            return str.substring(str.indexOf(':') + 1);
+        }
+    }
+
+    public int getFoo() {
+        return foo;
+    }
+
+    public void setFoo(int foo) {
+        this.foo = foo;
+    }
+
+    public int getBar() {
+        return bar;
+    }
+
+    public void setBar(int bar) {
+        this.bar = bar;
+    }
+}

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/util/ClassGenerator.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/util/ClassGenerator.java?view=diff&rev=491121&r1=491120&r2=491121
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/util/ClassGenerator.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/util/ClassGenerator.java Fri Dec 29 14:18:40 2006
@@ -14,15 +14,6 @@
  * limitations under the License.
  */
  
-
-//Title:        Your Product Name
-//Version:
-//Copyright:    Copyright (c) 1998
-//Author:
-//Company:      Your Company
-//Description:  Your description
-
-
 package org.apache.jdo.tck.util;
 
 import java.io.*;



Mime
View raw message