db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r637156 - in /db/jdo/trunk: tck2-legacy/src/conf/ tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/ tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/
Date Fri, 14 Mar 2008 16:48:33 GMT
Author: mcaisse
Date: Fri Mar 14 09:48:22 2008
New Revision: 637156

URL: http://svn.apache.org/viewvc?rev=637156&view=rev
Log:
JDO-579 Fixed assert argument order. Renamed fields hiding superclass fields. Removed @override.
Added missing tests to tck2-legacy.

Added:
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java
  (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListener.java
  (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListenerGetInstance.java
  (with props)
Modified:
    db/jdo/trunk/tck2-legacy/src/conf/pmf.conf
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java
    db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java
    db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java

Modified: db/jdo/trunk/tck2-legacy/src/conf/pmf.conf
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/conf/pmf.conf?rev=637156&r1=637155&r2=637156&view=diff
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/conf/pmf.conf (original)
+++ db/jdo/trunk/tck2-legacy/src/conf/pmf.conf Fri Mar 14 09:48:22 2008
@@ -48,3 +48,6 @@
 org.apache.jdo.tck.api.persistencemanagerfactory.SetOptimistic \
 org.apache.jdo.tck.api.persistencemanagerfactory.SetRetainValues \
 org.apache.jdo.tck.api.persistencemanagerfactory.SupportedOptions
+org.apache.jdo.tck.api.persistencemanagerfactory.config.Jdoconfig \
+org.apache.jdo.tck.api.persistencemanagerfactory.config.JDOConfigListener
+

Added: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java?rev=637156&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java
(added)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java
Fri Mar 14 09:48:22 2008
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.jdo.tck.api.persistencemanagerfactory.config;
+
+import java.util.HashMap;
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Transaction;
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>JDOConfigListener
+ *<BR/>
+ *<B>Keywords:</B> persistencemanagerfactory, jdoconfig.xml
+ *<BR/>
+ *<B>Assertion IDs:</B> A11.1-40
+ *<BR/>
+ *<B>Assertion Description: </B>
+ Properties whose key begins with the prefix
+ * "javax.jdo.listener.InstanceLifecycleListener." have special treatment.
+ * The part of the key following the prefix is used as the class name of a class
+ * that implements javax.jdo.listener.InstanceLifecycleListener.
+ * The implementation first attempts to get an instance via the static method
+ * getInstance() that returns an instance that implements the 
+ * javax.jdo.listener.InstanceLifecycleListener. If this is unsuccessful,
+ * an instance of this class is constructed via a no-args constructor.
+ * The value of the key is a comma-separated list of classes to which 
+ * the instantiated listener is registered to listen.
+ */
+
+public class JDOConfigListener extends JDO_Test {
+
+    /** Creates a new instance of JDOConfigListener */
+    public JDOConfigListener() {
+    }
+    /** */
+    private static final String ASSERTION_FAILED =
+            "Assertions 11.1-40 failed: ";
+    private static final String ANONYMOUS_PMF_NAME = "";
+    // Do not use superclass pmf, pm
+    private PersistenceManagerFactory pmf = null;
+    private PersistenceManager pm = null;
+    private HashMap overrides = new HashMap();
+
+    /**
+     * 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(JDOConfigListener.class);
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        /* Instance can be persisted ONLY if javax.jdo.mapping.Schema
+         *   is overriden with 
+         *   JDOHelper.getPersistenceManagerFactory(Map overrides, ...).
+         *   The value depends on identity type so can only be known at runtime.
+         */
+        if (isTestToBePerformed()) {
+            overrides.put("javax.jdo.mapping.Schema", schemaname);
+        }
+    }
+
+    /** 
+     * Test instantiation of InstanceLifecycleListener where listener class 
+     * and target classes are specified in jdoconfig.xml where listener
+     * class provides only a public no-args constructor.
+     */
+    public void testPCPointListener() {
+        String pmfname = "testInstanceLifecycleListenerStore";
+        pmf = JDOHelper.getPersistenceManagerFactory(overrides, pmfname);
+        makePersistent();
+        assertTrue("Expected preStore() to have been invoked.",
+                StoreListener.isPreStore());
+        assertTrue("Expected postStore() to have been invoked.",
+                StoreListener.isPostStore());
+    }
+
+    /** 
+     * Test instantiation of InstanceLifecycleListener where listener class
+     * and target classes are specified in jdoconfig.xml where listener
+     * class provides a static method getInstance().
+     */
+    public void testPCPointListenerGetInstance() {
+        String pmfname = "testInstanceLifecycleListenerStoreGetInstance";
+        pmf = JDOHelper.getPersistenceManagerFactory(overrides, pmfname);
+        makePersistent();
+        assertTrue("Expected preStore() to have been invoked.",
+                StoreListenerGetInstance.isPreStore());
+        assertTrue("Expected postStore() to have been invoked.",
+                StoreListenerGetInstance.isPostStore());
+    }
+
+    /** 
+     * Test instantiation of Instance LifeCycleListener specified via 
+     * property overrides.
+     */
+    public void testPCPointListenerOverrides() {
+        overrides.put("javax.jdo.listener.InstanceLifecycleListener.org.apache.jdo.tck.api.persistencemanagerfactory.config.StoreListener",
+                "org.apache.jdo.tck.pc.mylib.PCPoint");
+        String pmfname = "testInstanceLifecycleListenerStoreOverrides";
+        pmf = JDOHelper.getPersistenceManagerFactory(overrides, pmfname);
+        makePersistent();
+        assertTrue("Expected preStore() to have been invoked.",
+                StoreListener.isPreStore());
+        assertTrue("Expected postStore() to have been invoked.",
+                StoreListener.isPostStore());
+    }
+
+    /** 
+     * Test instantiation of InstanceLifecycleListener where class value
+     * is null
+     */
+    public void testPCPointListenerNullClasses() {
+        String pmfname = "testInstanceLifecycleListenerClassesNull";
+        pmf = JDOHelper.getPersistenceManagerFactory(overrides, pmfname);
+        makePersistent();
+        assertTrue("Expected preStore() to have been invoked.",
+                StoreListener.isPreStore());
+        assertTrue("Expected postStore() to have been invoked.",
+                StoreListener.isPostStore());
+    }
+
+    protected void makePersistent() {
+        addTearDownClass(PCPoint.class);
+        pm = pmf.getPersistenceManager();
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        PCPoint comp = new PCPoint(1, 2);
+        pm.makePersistent(comp);
+        tx.commit();
+    }
+
+    protected void localTearDown() {
+        super.localTearDown();
+        StoreListener.resetValues();
+        StoreListenerGetInstance.resetValues();
+        pmf.close();
+        pmf = null;
+    }
+}

Propchange: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Modified: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java?rev=637156&r1=637155&r2=637156&view=diff
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java
(original)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java
Fri Mar 14 09:48:22 2008
@@ -46,8 +46,8 @@
             "Assertion A11.1.2-1 failed: ";
     private static final String ANONYMOUS_PMF_NAME = "";
     // Do not use superclass pmf, pm
-    private PersistenceManagerFactory pmf = null;
-    private PersistenceManager pm = null;
+    private PersistenceManagerFactory privatePmf = null;
+    private PersistenceManager privatePm = null;
     private HashMap overrides = new HashMap();
 
     /**
@@ -75,90 +75,90 @@
 
     /** */ 
     public void testGetPMFNoArgs() {
-        pmf = JDOHelper.getPersistenceManagerFactory();
+        privatePmf = JDOHelper.getPersistenceManagerFactory();
         checkIsOpen(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFEmptyString() {
         String name = "";
-        pmf = JDOHelper.getPersistenceManagerFactory(name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(name);
         checkIsOpen(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFNull() {
         String name = null;
-        pmf = JDOHelper.getPersistenceManagerFactory(name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(name);
         checkIsOpen(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFStringSpace() {
         String name = " ";
-        pmf = JDOHelper.getPersistenceManagerFactory(name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(name);
         checkIsOpen(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFNamed() {
         String name = "namedPMF0";
-        pmf = JDOHelper.getPersistenceManagerFactory(name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(name);
         assertEquals("Incorrect value for RestoreValues",
-                pmf.getRestoreValues(), false);
+                privatePmf.getRestoreValues(), false);
         checkIsOpen(name);
     }
 
     /** */
     public void testGetPMFEmptyStringOverrides() {
         String name = "";
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
         checkPersistent(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFNullOverrides() {
         String name = null;
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
         checkPersistent(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFStringSpaceOverrides() {
         String name = " ";
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
         checkPersistent(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFNamedOverrides() {
         String name = "namedPMF0";
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
         assertEquals("Incorrect value for RestoreValues",
-                pmf.getRestoreValues(), false);
+                privatePmf.getRestoreValues(), false);
         checkPersistent(name);
     }
 
     /** */
     public void testGetPMFNamedSpacesOverrides() {
         String name = "namedPMF1";
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides,
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides,
                 " \t" + name + " \n");
         assertEquals("Incorrect value for RestoreValues",
-                pmf.getRestoreValues(), true);
+                privatePmf.getRestoreValues(), true);
         checkPersistent(name);
     }
 
     /** */
     public void checkIsOpen(String name) {
-        assertEquals("Incorrect PMF name", pmf.getName(), name);
-        if (pmf.isClosed()) {
+        assertEquals("Incorrect PMF name", name, privatePmf.getName());
+        if (privatePmf.isClosed()) {
             fail(ASSERTION_FAILED,
                     "PMF.isClosed() returned true on an open pmf");
         }
-        pmf.close();
+        privatePmf.close();
         // have next invocation of getPMF() get a new pmf
-        pmf = null;
+        privatePmf = null;
     }
 
     /** 
@@ -167,26 +167,26 @@
      *    with JDOHelper.getPersistenceManagerFactory(Map overrides, ...).
      */
     public void checkPersistent(String name) {
-        assertEquals("Incorrect PMF name", pmf.getName(), name);
+        assertEquals("Incorrect PMF name", name, privatePmf.getName());
 
         makePersistent();
 
-        pmf.close();
-        if (!pmf.isClosed()) {
+        privatePmf.close();
+        if (!privatePmf.isClosed()) {
             fail(ASSERTION_FAILED,
                     "PMF.isClosed() returned false on a closed pmf");
         }
         // have next invocation of getPMF() get a new pmf
-        pmf = null;
+        privatePmf = null;
     }
 
     protected void makePersistent() {
         addTearDownClass(PCPoint.class);
-        pm = pmf.getPersistenceManager();
-        Transaction tx = pm.currentTransaction();
+        privatePm = privatePmf.getPersistenceManager();
+        Transaction tx = privatePm.currentTransaction();
         tx.begin();
         PCPoint comp = new PCPoint(1, 2);
-        pm.makePersistent(comp);
+        privatePm.makePersistent(comp);
         tx.commit();
     }
 }

Added: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListener.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListener.java?rev=637156&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListener.java
(added)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListener.java
Fri Mar 14 09:48:22 2008
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanagerfactory.config;
+
+import javax.jdo.listener.InstanceLifecycleEvent;
+import javax.jdo.listener.StoreLifecycleListener;
+
+/**
+ * A StoreLivecycleListener implementation that provides a public no-args 
+ * constructor that may be invoked by a JDO implementation, 
+ * but NO getInstance() method.
+ */
+public class StoreListener implements StoreLifecycleListener {
+
+    private static boolean preStore = false;
+    private static boolean postStore = false;
+    private static int instanceCount = 0;
+
+    public StoreListener() {
+        instanceCount++;
+    }
+
+    public static boolean isPreStore() {
+        return preStore;
+    }
+
+    public static boolean isPostStore() {
+        return postStore;
+    }
+
+    public static void resetValues() {
+        preStore = false;
+        postStore = false;
+    }
+
+    public void preStore(InstanceLifecycleEvent event) {
+//        System.out.println("preStore: event is " + event);
+        preStore = true;
+    }
+
+    public void postStore(InstanceLifecycleEvent event) {
+//        System.out.println("postStore: event is " + event);
+        postStore = true;
+    }
+}

Propchange: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListener.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListenerGetInstance.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListenerGetInstance.java?rev=637156&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListenerGetInstance.java
(added)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListenerGetInstance.java
Fri Mar 14 09:48:22 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.jdo.tck.api.persistencemanagerfactory.config;
+
+import javax.jdo.listener.InstanceLifecycleEvent;
+import javax.jdo.listener.StoreLifecycleListener;
+
+/**
+ * A StoreLifecycleListener implementation that provides a getInstance() method
+ * that may be invoked by a JDO implementation.
+ */
+public class StoreListenerGetInstance implements StoreLifecycleListener {
+
+    private static boolean preStore = false;
+    private static boolean postStore = false;
+    private static int instanceCount = 0;
+    private static StoreListenerGetInstance slInstance = 
+            new StoreListenerGetInstance();
+
+    private StoreListenerGetInstance() {
+        instanceCount++;
+    }
+
+    public static StoreListenerGetInstance getInstance() {
+        return slInstance;
+    }
+
+    public static boolean isPreStore() {
+        return preStore;
+    }
+
+    public static boolean isPostStore() {
+        return postStore;
+    }
+
+    public static void resetValues() {
+        preStore = false;
+        postStore = false;
+    }
+
+    public void preStore(InstanceLifecycleEvent event) {
+//        System.out.println("preStore: event is " + event);
+        preStore = true;
+    }
+
+    public void postStore(InstanceLifecycleEvent event) {
+//        System.out.println("postStore: event is " + event);
+        postStore = true;
+    }
+}

Propchange: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/StoreListenerGetInstance.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Modified: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java?rev=637156&r1=637155&r2=637156&view=diff
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java
(original)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/JDOConfigListener.java
Fri Mar 14 09:48:22 2008
@@ -152,7 +152,6 @@
         tx.commit();
     }
 
-    @Override
     protected void localTearDown() {
         super.localTearDown();
         StoreListener.resetValues();

Modified: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java?rev=637156&r1=637155&r2=637156&view=diff
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java
(original)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Jdoconfig.java
Fri Mar 14 09:48:22 2008
@@ -46,8 +46,8 @@
             "Assertion A11.1.2-1 failed: ";
     private static final String ANONYMOUS_PMF_NAME = "";
     // Do not use superclass pmf, pm
-    private PersistenceManagerFactory pmf = null;
-    private PersistenceManager pm = null;
+    private PersistenceManagerFactory privatePmf = null;
+    private PersistenceManager privatePm = null;
     private HashMap overrides = new HashMap();
 
     /**
@@ -75,90 +75,90 @@
 
     /** */ 
     public void testGetPMFNoArgs() {
-        pmf = JDOHelper.getPersistenceManagerFactory();
+        privatePmf = JDOHelper.getPersistenceManagerFactory();
         checkIsOpen(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFEmptyString() {
         String name = "";
-        pmf = JDOHelper.getPersistenceManagerFactory(name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(name);
         checkIsOpen(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFNull() {
         String name = null;
-        pmf = JDOHelper.getPersistenceManagerFactory(name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(name);
         checkIsOpen(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFStringSpace() {
         String name = " ";
-        pmf = JDOHelper.getPersistenceManagerFactory(name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(name);
         checkIsOpen(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFNamed() {
         String name = "namedPMF0";
-        pmf = JDOHelper.getPersistenceManagerFactory(name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(name);
         assertEquals("Incorrect value for RestoreValues",
-                pmf.getRestoreValues(), false);
+                privatePmf.getRestoreValues(), false);
         checkIsOpen(name);
     }
 
     /** */
     public void testGetPMFEmptyStringOverrides() {
         String name = "";
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
         checkPersistent(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFNullOverrides() {
         String name = null;
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
         checkPersistent(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFStringSpaceOverrides() {
         String name = " ";
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
         checkPersistent(ANONYMOUS_PMF_NAME);
     }
 
     /** */
     public void testGetPMFNamedOverrides() {
         String name = "namedPMF0";
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides, name);
         assertEquals("Incorrect value for RestoreValues",
-                pmf.getRestoreValues(), false);
+                privatePmf.getRestoreValues(), false);
         checkPersistent(name);
     }
 
     /** */
     public void testGetPMFNamedSpacesOverrides() {
         String name = "namedPMF1";
-        pmf = JDOHelper.getPersistenceManagerFactory(overrides,
+        privatePmf = JDOHelper.getPersistenceManagerFactory(overrides,
                 " \t" + name + " \n");
         assertEquals("Incorrect value for RestoreValues",
-                pmf.getRestoreValues(), true);
+                privatePmf.getRestoreValues(), true);
         checkPersistent(name);
     }
 
     /** */
     public void checkIsOpen(String name) {
-        assertEquals("Incorrect PMF name", pmf.getName(), name);
-        if (pmf.isClosed()) {
+        assertEquals("Incorrect PMF name", name, privatePmf.getName());
+        if (privatePmf.isClosed()) {
             fail(ASSERTION_FAILED,
                     "PMF.isClosed() returned true on an open pmf");
         }
-        pmf.close();
+        privatePmf.close();
         // have next invocation of getPMF() get a new pmf
-        pmf = null;
+        privatePmf = null;
     }
 
     /** 
@@ -167,26 +167,26 @@
      *    with JDOHelper.getPersistenceManagerFactory(Map overrides, ...).
      */
     public void checkPersistent(String name) {
-        assertEquals("Incorrect PMF name", pmf.getName(), name);
+        assertEquals("Incorrect PMF name", name, privatePmf.getName());
 
         makePersistent();
 
-        pmf.close();
-        if (!pmf.isClosed()) {
+        privatePmf.close();
+        if (!privatePmf.isClosed()) {
             fail(ASSERTION_FAILED,
                     "PMF.isClosed() returned false on a closed pmf");
         }
         // have next invocation of getPMF() get a new pmf
-        pmf = null;
+        privatePmf = null;
     }
 
     protected void makePersistent() {
         addTearDownClass(PCPoint.class);
-        pm = pmf.getPersistenceManager();
-        Transaction tx = pm.currentTransaction();
+        privatePm = privatePmf.getPersistenceManager();
+        Transaction tx = privatePm.currentTransaction();
         tx.begin();
         PCPoint comp = new PCPoint(1, 2);
-        pm.makePersistent(comp);
+        privatePm.makePersistent(comp);
         tx.commit();
     }
 }



Mime
View raw message