openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r953189 - /openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java
Date Wed, 09 Jun 2010 23:30:29 GMT
Author: mikedd
Date: Wed Jun  9 23:30:29 2010
New Revision: 953189

URL: http://svn.apache.org/viewvc?rev=953189&view=rev
Log:
OPENJPA-1678: delete tests which write to log files

Modified:
    openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java

Modified: openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java?rev=953189&r1=953188&r2=953189&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java
(original)
+++ openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java
Wed Jun  9 23:30:29 2010
@@ -107,79 +107,4 @@ public class TestParameterLogging extend
             nested = nested.getCause();
         }
     }
-
-    /*
-     * If the EMF is created with PrintParameters=false and trace is enabled for SQL the
parameter values will not be
-     * logged in exception text.
-     */
-    public void testParamsDisbledWithLogging() throws Exception {
-        RollbackException e =
-            getRollbackException(PObject.class, CLEAR_TABLES, "openjpa.ConnectionFactoryProperties",
-                "PrintParameters=false", "openjpa.Log", "SQL=TRACE,File=temp.txt");
-        assertFalse(Pattern.matches(_regex, e.toString()));
-        Throwable nested = e.getCause();
-        assertNotNull(nested); // should be at least one nested exception
-        while (nested != null) {
-            if (Pattern.matches(".*INSERT.*", nested.toString())) {
-                // only check if the message contains the insert statement.
-                assertFalse(Pattern.matches(_regex, nested.toString()));
-            }
-            nested = nested.getCause();
-        }
-        checkAndDeleteLogFile("temp.txt", false);
-    }
-
-    /*
-     * If the EMF is created with PrintParameters=false and trace is enabled for SQL the
parameter values will not be
-     * logged in exception text.
-     */
-    public void testParamsEnabledWithLogging() throws Exception {
-        RollbackException e =
-            getRollbackException(PObject.class, CLEAR_TABLES, "openjpa.ConnectionFactoryProperties",
-                "PrintParameters=true", "openjpa.Log", "SQL=TRACE,File=temp.txt");
-        assertFalse(Pattern.matches(_regex, e.toString()));
-        Throwable nested = e.getCause();
-        assertNotNull(nested); // should be at least one nested exception
-        while (nested != null) {
-            if (Pattern.matches(".*INSERT.*", nested.toString())) {
-                // only check if the message contains the insert statement.
-                assertTrue(Pattern.matches(_regex, nested.toString()));
-            }
-            nested = nested.getCause();
-        }
-        checkAndDeleteLogFile("temp.txt", true);
-    }
-
-    private void checkAndDeleteLogFile(String filename, boolean containsParams) throws Exception
{
-        File f = null;
-        FileReader fr = null;
-        BufferedReader br = null;
-        try {
-            f = new File(filename);
-            fr = new FileReader(f);
-            br = new BufferedReader(fr);
-
-            String s = br.readLine();
-            while (s != null) {
-                if (Pattern.matches(".*INSERT.*", s)) {
-                    if (containsParams) {
-                        assertTrue(Pattern.matches(_regex, s));
-                    } else {
-                        assertFalse(Pattern.matches(_regex, s));
-                    }
-                }
-                s = br.readLine();
-            }
-        } finally {
-            if (br != null) {
-                br.close();
-            }
-            if (fr != null) {
-                fr.close();
-            }
-            if (f != null) {
-                f.delete();
-            }
-        }
-    }
 }



Mime
View raw message