db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r1817115 - /db/jdo/trunk/api/test/java/javax/jdo/PMFMapMapTest.java
Date Mon, 04 Dec 2017 18:43:42 GMT
Author: mbo
Date: Mon Dec  4 18:43:42 2017
New Revision: 1817115

URL: http://svn.apache.org/viewvc?rev=1817115&view=rev
Log:
JDO-768: fixed failure in api test case testGetPMFNullResource(javax.jdo.JDOHelperTest)

Modified:
    db/jdo/trunk/api/test/java/javax/jdo/PMFMapMapTest.java

Modified: db/jdo/trunk/api/test/java/javax/jdo/PMFMapMapTest.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/test/java/javax/jdo/PMFMapMapTest.java?rev=1817115&r1=1817114&r2=1817115&view=diff
==============================================================================
--- db/jdo/trunk/api/test/java/javax/jdo/PMFMapMapTest.java (original)
+++ db/jdo/trunk/api/test/java/javax/jdo/PMFMapMapTest.java Mon Dec  4 18:43:42 2017
@@ -46,7 +46,6 @@ public class PMFMapMapTest extends Abstr
     Properties props;
     Properties overrides;
     URLClassLoader resourceClassLoader;
-    ClassLoader saveContextClassLoader;
 
     public static void main(String args[]) {
         BatchTestRunner.run(PMFMapMapTest.class);
@@ -89,6 +88,7 @@ public class PMFMapMapTest extends Abstr
     public void testJDOConfigXML() throws IOException {
 
         setupResourceClassLoader(resourceDir);
+        ClassLoader saveContextClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(resourceClassLoader);
 
         try {
@@ -96,6 +96,8 @@ public class PMFMapMapTest extends Abstr
         } catch (JDOFatalUserException ex) {
             fail("Failed to find PersistenceManagerFactoryClass."
                     + ex.getMessage());
+        } finally {
+            Thread.currentThread().setContextClassLoader(saveContextClassLoader);
         }
 
         String driverName = pmf.getConnectionDriverName();
@@ -137,6 +139,7 @@ public class PMFMapMapTest extends Abstr
     public void testPropsFile() throws IOException {
 
         setupResourceClassLoader(propsDir);
+        ClassLoader saveContextClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(resourceClassLoader);
 
         try {
@@ -144,6 +147,8 @@ public class PMFMapMapTest extends Abstr
         } catch (JDOFatalUserException ex) {
             fail("Failed to find PersistenceManagerFactoryClass."
                     + ex.getMessage());
+        } finally {
+            Thread.currentThread().setContextClassLoader(saveContextClassLoader);
         }
 
         String driverName = pmf.getConnectionDriverName();
@@ -199,6 +204,7 @@ public class PMFMapMapTest extends Abstr
                 outstream.toByteArray());
 
         setupResourceClassLoader(resourceDir);
+        ClassLoader saveContextClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(resourceClassLoader);
 
         try {
@@ -206,6 +212,8 @@ public class PMFMapMapTest extends Abstr
         } catch (JDOFatalUserException ex) {
             fail("Failed to find PersistenceManagerFactoryClass."
                     + ex.getMessage());
+        } finally {
+            Thread.currentThread().setContextClassLoader(saveContextClassLoader);
         }
 
         String driverName = pmf.getConnectionDriverName();
@@ -266,12 +274,15 @@ public class PMFMapMapTest extends Abstr
         props.setProperty(PROPERTY_CONNECTION_DRIVER_NAME, expectedDriverName);
 
         setupResourceClassLoader(resourceDir);
+        ClassLoader saveContextClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(resourceClassLoader);
         try {
             pmf = JDOHelper.getPersistenceManagerFactory(props);
         } catch (JDOFatalUserException ex) {
             fail("Failed to find PersistenceManagerFactoryClass."
                     + ex.getMessage());
+        } finally {
+            Thread.currentThread().setContextClassLoader(saveContextClassLoader);
         }
 
         String driverName = pmf.getConnectionDriverName();
@@ -319,6 +330,7 @@ public class PMFMapMapTest extends Abstr
                 expectedDriverNameWithOverrides);
 
         setupResourceClassLoader(resourceDir);
+        ClassLoader saveContextClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(resourceClassLoader);
 
         try {
@@ -326,6 +338,8 @@ public class PMFMapMapTest extends Abstr
         } catch (JDOFatalUserException ex) {
             fail("Failed to find PersistenceManagerFactoryClass."
                     + ex.getMessage());
+        } finally {
+            Thread.currentThread().setContextClassLoader(saveContextClassLoader);
         }
 
         String driverName = pmf.getConnectionDriverName();
@@ -384,8 +398,7 @@ public class PMFMapMapTest extends Abstr
 
         try {
             pmf = JDOHelper.getPersistenceManagerFactory(overrides, PMFName,
-                    resourceClassLoader, Thread.currentThread()
-                            .getContextClassLoader());
+                    resourceClassLoader, resourceClassLoader);
         } catch (JDOFatalUserException ex) {
             fail("Failed to find PersistenceManagerFactoryClass. "
                     + ex.getMessage());
@@ -407,6 +420,7 @@ public class PMFMapMapTest extends Abstr
     public void testNamedPMF() throws IOException {
 
         setupResourceClassLoader(resourceDir);
+        ClassLoader saveContextClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(resourceClassLoader);
 
         try {
@@ -414,6 +428,8 @@ public class PMFMapMapTest extends Abstr
         } catch (JDOFatalUserException ex) {
             fail("Failed to find PersistenceManagerFactoryClass. "
                     + ex.getMessage());
+        } finally {
+            Thread.currentThread().setContextClassLoader(saveContextClassLoader);
         }
 
         String driverName = pmf.getConnectionDriverName();
@@ -459,8 +475,7 @@ public class PMFMapMapTest extends Abstr
 
         try {
             pmf = JDOHelper.getPersistenceManagerFactory(PMFName,
-                    resourceClassLoader, Thread.currentThread()
-                            .getContextClassLoader());
+                    resourceClassLoader, resourceClassLoader);
         } catch (JDOFatalUserException ex) {
             fail("Failed to find PersistenceManagerFactoryClass. "
                     + ex.getMessage());



Mime
View raw message