svn commit: r744918 - /commons/proper/math/trunk/src/test/R/correlationTestCases
Author: psteitz Date: Mon Feb 16 13:52:33 2009 New Revision: 744918 URL: http://svn.apache.org/viewvc?rev=744918view=rev Log: Increased sensitivity of test and added another p-value verification. Modified: commons/proper/math/trunk/src/test/R/correlationTestCases Modified: commons/proper/math/trunk/src/test/R/correlationTestCases URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/R/correlationTestCases?rev=744918r1=744917r2=744918view=diff == --- commons/proper/math/trunk/src/test/R/correlationTestCases (original) +++ commons/proper/math/trunk/src/test/R/correlationTestCases Mon Feb 16 13:52:33 2009 @@ -22,7 +22,7 @@ # source(name-of-this-file) # #-- -tol - 1E-9 # error tolerance for tests +tol - 1E-15 # error tolerance for tests #-- # Function definitions @@ -172,14 +172,20 @@ 42.8,27.7,22,29,58.33), nrow = 47, ncol = 5, byrow = TRUE) - expectedCorrelation - matrix(c( +expectedCorrelation - matrix(c( 1., 0.3530791836199747, -0.6458827064572875, -0.6637888570350691, 0.4636847006517939, 0.3530791836199747, 1.,-0.6865422086171366, -0.6395225189483201, 0.4010950530487398, -0.6458827064572875, -0.6865422086171366, 1., 0.6984152962884830, -0.5727418060641666, -0.6637888570350691, -0.6395225189483201, 0.6984152962884830, 1., -0.1538589170909148, 0.4636847006517939, 0.4010950530487398, -0.5727418060641666, -0.1538589170909148, 1.), nrow = 5, ncol = 5, byrow = TRUE) - verifyCorrelation(fertility, expectedCorrelation, swiss fertility) -displayDashes(WIDTH) \ No newline at end of file +expectedPValues - c( + 0.01491720061472623, + 9.45043734069043e-07, 9.95151527133974e-08, + 3.658616965962355e-07, 1.304590105694471e-06, 4.811397236181847e-08, + 0.001028523190118147, 0.005204433539191644, 2.588307925380906e-05, 0.301807756132683) +verifyPValues(fertility, expectedPValues, swiss fertility) + +displayDashes(WIDTH)
svn commit: r744922 - in /commons/sandbox/compress/trunk/src: main/java/org/apache/commons/compress/changes/ test/java/org/apache/commons/compress/ test/java/org/apache/commons/compress/archivers/ tes
Author: bodewig Date: Mon Feb 16 14:19:43 2009 New Revision: 744922 URL: http://svn.apache.org/viewvc?rev=744922view=rev Log: new testcases by Christian Grobmeier - SANDBOX-183 Added: commons/sandbox/compress/trunk/src/test/resources/test with spaces.txt (with props) commons/sandbox/compress/trunk/src/test/resources/test3.xml (with props) commons/sandbox/compress/trunk/src/test/resources/test4.xml (with props) Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java?rev=744922r1=744921r2=744922view=diff == --- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java (original) +++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java Mon Feb 16 14:19:43 2009 @@ -66,7 +66,6 @@ if( change.type() == Change.TYPE_DELETE entry.getName() != null entry.getName().equals(change.targetFile())) { - System.out.println(Delete: + entry.getName()); copy = false; it.remove(); break; @@ -83,7 +82,5 @@ out.putArchiveEntry(entry); IOUtils.copy(in, out); out.closeArchiveEntry(); - System.out.println(Copy: + entry.getName()); } - } Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java?rev=744922r1=744921r2=744922view=diff == --- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java (original) +++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java Mon Feb 16 14:19:43 2009 @@ -18,10 +18,26 @@ */ package org.apache.commons.compress; +import java.io.BufferedInputStream; import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.List; import junit.framework.TestCase; +import org.apache.commons.compress.archivers.ArchiveEntry; +import org.apache.commons.compress.archivers.ArchiveInputStream; +import org.apache.commons.compress.archivers.ArchiveOutputStream; +import org.apache.commons.compress.archivers.ArchiveStreamFactory; +import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; +import org.apache.commons.compress.utils.IOUtils; + public abstract class AbstractTestCase extends TestCase { protected File dir; @@ -30,6 +46,8 @@ dir = File.createTempFile(dir, ); dir.delete(); dir.mkdir(); + + addURL(new File(src/test/resources).toURL()); } protected File getFile( String path ) { @@ -41,5 +59,126 @@ dir = null; } + /** +* Adds a URL to the classpath. This method is necessary when running +* junit tests from within eclipse. +* @param url the url to add +* @throws Exception if an error occurs +*/ + public void addURL(URL url) throws Exception { + URLClassLoader classLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); + Class clazz = URLClassLoader.class; + + Method method= clazz.getDeclaredMethod(addURL, new Class[] { URL.class }); + method.setAccessible(true); + method.invoke(classLoader, new Object[] { url }); + } + /** +* Creates an archive of 5 textbased files in several directories. +* The archivername is the factory identifier for the archiver, for example +* zip, tar, cpio, jar, ar. +* The archive is created as a temp file. +* +* The archive contains
svn commit: r744923 - in /commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress: AbstractTestCase.java DetectArchiverTestCase.java archivers/ZipTestCase.java changes/ChangeSetTestCa
Author: bodewig Date: Mon Feb 16 14:21:12 2009 New Revision: 744923 URL: http://svn.apache.org/viewvc?rev=744923view=rev Log: fix whitespace Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java?rev=744923r1=744922r2=744923view=diff == --- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java (original) +++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java Mon Feb 16 14:21:12 2009 @@ -40,145 +40,145 @@ public abstract class AbstractTestCase extends TestCase { - protected File dir; - - protected void setUp() throws Exception { - dir = File.createTempFile(dir, ); - dir.delete(); - dir.mkdir(); - - addURL(new File(src/test/resources).toURL()); - } - - protected File getFile( String path ) { - return new File(getClass().getClassLoader().getResource(path).getFile()); - } - - protected void tearDown() throws Exception { - dir.delete(); - dir = null; - } - - /** -* Adds a URL to the classpath. This method is necessary when running -* junit tests from within eclipse. -* @param url the url to add -* @throws Exception if an error occurs -*/ - public void addURL(URL url) throws Exception { - URLClassLoader classLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); - Class clazz = URLClassLoader.class; - - Method method= clazz.getDeclaredMethod(addURL, new Class[] { URL.class }); - method.setAccessible(true); - method.invoke(classLoader, new Object[] { url }); - } - - /** -* Creates an archive of 5 textbased files in several directories. -* The archivername is the factory identifier for the archiver, for example -* zip, tar, cpio, jar, ar. -* The archive is created as a temp file. -* -* The archive contains the following files: -* ul -* litestdata/test1.xml/li -* litestdata/test2.xml/li -* litest/test3.xml/li -* libla/test4.xml/li -* litest.txt/li -* lisomething/bla/li -* litest with spaces.txt/li -* /ul -* -* @param archivename the identifier of this archive -* @return the newly created file -* @throws Exception in case something goes wrong -*/ - protected File createArchive(String archivename) throws Exception { - ArchiveOutputStream out = null; - ArchiveInputStream ais = null; - try { - File temp = File.createTempFile(test, . + archivename); - - final OutputStream stream = new FileOutputStream(temp); - out = new ArchiveStreamFactory().createArchiveOutputStream(archivename, stream); - - final File file1 = getFile(test1.xml); - final File file2 = getFile(test2.xml); - final File file3 = getFile(test3.xml); - final File file4 = getFile(test4.xml); - final File file5 = getFile(test.txt); - final File file6 = getFile(test with spaces.txt); - - ZipArchiveEntry entry = new ZipArchiveEntry(testdata/test1.xml); - entry.setSize(file1.length()); - out.putArchiveEntry(entry); - IOUtils.copy(new FileInputStream(file1), out); - out.closeArchiveEntry(); - - out.putArchiveEntry(new ZipArchiveEntry(testdata/test2.xml)); - IOUtils.copy(new FileInputStream(file2), out); - out.closeArchiveEntry(); - - out.putArchiveEntry(new ZipArchiveEntry(test/test3.xml)); - IOUtils.copy(new FileInputStream(file3), out); - out.closeArchiveEntry(); - - out.putArchiveEntry(new ZipArchiveEntry(bla/test4.xml)); - IOUtils.copy(new FileInputStream(file4), out); -
svn commit: r744932 - /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java
Author: psteitz Date: Mon Feb 16 15:12:51 2009 New Revision: 744932 URL: http://svn.apache.org/viewvc?rev=744932view=rev Log: Eliminated unused private field. JIRA: DBCP-255 Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java?rev=744932r1=744931r2=744932view=diff == --- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java (original) +++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java Mon Feb 16 15:12:51 2009 @@ -43,8 +43,6 @@ /** DBCP AbandonedConfig */ private AbandonedConfig config = null; -/** Parent object */ -private volatile AbandonedTrace parent; /** A stack trace of the code that created me (if in debug mode) */ private volatile Exception createdBy; /** Time created */ @@ -59,7 +57,7 @@ * without doing abandoned tracing. */ public AbandonedTrace() { -init(parent); +init(null); } /** @@ -69,7 +67,7 @@ */ public AbandonedTrace(AbandonedConfig config) { this.config = config; -init(parent); +init(null); } /** @@ -116,9 +114,6 @@ * @return long time in ms */ protected long getLastUsed() { -if (parent != null) { - return parent.getLastUsed(); -} return lastUsed; } @@ -127,11 +122,7 @@ * current time in ms. */ protected void setLastUsed() { -if (parent != null) { - parent.setLastUsed(); -} else { - lastUsed = System.currentTimeMillis(); -} +lastUsed = System.currentTimeMillis(); } /** @@ -140,11 +131,7 @@ * @param time time in ms */ protected void setLastUsed(long time) { -if (parent != null) { - parent.setLastUsed(time); -} else { - lastUsed = time; -} +lastUsed = time; } /** @@ -160,9 +147,6 @@ createdBy = new Exception(); createdTime = System.currentTimeMillis(); } -if (parent != null) { -parent.addTrace(this); -} } /**
svn commit: r744957 - /commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
Author: sebb Date: Mon Feb 16 16:32:48 2009 New Revision: 744957 URL: http://svn.apache.org/viewvc?rev=744957view=rev Log: COLLECTIONS-294: Replace Locale(tr) with Locale(tr,,) to be Java 1.3 compliant Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java?rev=744957r1=744956r2=744957view=diff == --- commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java (original) +++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java Mon Feb 16 16:32:48 2009 @@ -123,7 +123,7 @@ public void testLocaleIndependence() { Locale orig = Locale.getDefault(); -Locale[] locales = { Locale.ENGLISH, new Locale(tr), Locale.getDefault() }; +Locale[] locales = { Locale.ENGLISH, new Locale(tr, , ), Locale.getDefault() }; String[][] data = { { i, I },