commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r232283 - in /jakarta/commons/sandbox/jci/trunk: ./ src/test/org/apache/commons/jci/ src/test/org/apache/commons/jci/monitor/
Date Fri, 12 Aug 2005 13:10:35 GMT
Author: tcurdt
Date: Fri Aug 12 06:10:29 2005
New Revision: 232283

URL: http://svn.apache.org/viewcvs?rev=232283&view=rev
Log:
fixed the testcases,
added coverage report,
turned off logging on tests


Modified:
    jakarta/commons/sandbox/jci/trunk/project.properties
    jakarta/commons/sandbox/jci/trunk/project.xml
    jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/AbstractTestCase.java
    jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/CompilingClassLoaderTestCase.java
    jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java

Modified: jakarta/commons/sandbox/jci/trunk/project.properties
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/project.properties?rev=232283&r1=232282&r2=232283&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/project.properties (original)
+++ jakarta/commons/sandbox/jci/trunk/project.properties Fri Aug 12 06:10:29 2005
@@ -24,8 +24,8 @@
 maven.jar.excludes = **/package.html
 #maven.junit.fork = true
 
-maven.junit.sysproperties = org.apache.commons.logging.Log
-org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog
+#maven.junit.sysproperties = org.apache.commons.logging.Log
+#org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog
 
 # ------------------------------------------------------------------------
 # M A V E N  J A R  O V E R R I D E

Modified: jakarta/commons/sandbox/jci/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/project.xml?rev=232283&r1=232282&r2=232283&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/project.xml (original)
+++ jakarta/commons/sandbox/jci/trunk/project.xml Fri Aug 12 06:10:29 2005
@@ -131,9 +131,7 @@
     <report>maven-file-activity-plugin</report>
     <report>maven-javadoc-plugin</report>
     <report>maven-junit-report-plugin</report>
-    <!--
     <report>maven-jcoverage-plugin</report>
-    -->
     <report>maven-jxr-plugin</report>
     <report>maven-linkcheck-plugin</report>
   </reports>

Modified: jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/AbstractTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/AbstractTestCase.java?rev=232283&r1=232282&r2=232283&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/AbstractTestCase.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/AbstractTestCase.java
Fri Aug 12 06:10:29 2005
@@ -63,18 +63,38 @@
     }
     
     
-    protected void writeFile( final File pFile, final String pText ) throws IOException {
-        final File parent = pFile.getParentFile();
+    protected File createDirectory( final String pName ) throws Exception {
+        final File newDirectory = new File(directory, pName);
+        assertTrue(newDirectory.mkdir());
+        assertTrue(newDirectory.exists());
+        assertTrue(newDirectory.isDirectory());
+        return newDirectory;
+    }
+    
+    protected File writeFile( final String pName, final String pText ) throws Exception {
+        final File file = new File(directory, pName);
+        final File parent = file.getParentFile();
         if (!parent.exists()) {
             if (!parent.mkdirs()) {
                 throw new IOException("could not create" + parent);
             }
         }
-        final FileWriter writer = new FileWriter(pFile);
+        final FileWriter writer = new FileWriter(file);
         writer.write(pText);
         writer.close();
         
-        assertTrue(pFile.exists());
+        assertTrue(file.exists());
+        assertTrue(file.isFile());
+        
+        return file;
+    }
+    
+    protected void delay() {
+        try {
+            Thread.sleep(1000);
+        } catch (final InterruptedException e) {
+            ;
+        }
     }
     
     protected File createTempDirectory() throws IOException {

Modified: jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/CompilingClassLoaderTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/CompilingClassLoaderTestCase.java?rev=232283&r1=232282&r2=232283&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/CompilingClassLoaderTestCase.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/CompilingClassLoaderTestCase.java
Fri Aug 12 06:10:29 2005
@@ -32,10 +32,11 @@
     }
 
     private void initialCompile() throws Exception {
-
+        delay();
+        
         waitForSignal(reload);
 
-        writeFile(new File(directory, "jci/Simple.java"),
+        writeFile("jci/Simple.java",
                 "package jci;\n"
                 + "public class Simple { \n"
                 + "  public String toString() { \n"
@@ -44,7 +45,7 @@
                 + "} \n"
         );
         
-        writeFile(new File(directory, "jci/Extended.java"),
+        writeFile("jci/Extended.java",
                 "package jci;\n"
                 + "public class Extended extends Simple { \n"
                 + "  public String toString() { \n"
@@ -80,7 +81,7 @@
         o = cl.loadClass("jci.Extended").newInstance();        
         assertTrue("Extended:Simple".equals(o.toString()));
 
-        writeFile(new File(directory, "jci/Simple.java"),
+        writeFile("jci/Simple.java",
                 "package jci;\n"
                 + "public class Simple { \n"
                 + "  public String toString() { \n"

Modified: jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java?rev=232283&r1=232282&r2=232283&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java
Fri Aug 12 06:10:29 2005
@@ -100,12 +100,9 @@
     public void testCreateFileDetection() throws Exception {
         start();
         
-        log.debug("creating file");
+        delay();
         
-        final File file = new File(directory, "file");
-        writeFile(file, "file");
-        assertTrue(file.exists());
-        assertTrue(file.isFile());
+        writeFile("file", "file");
         
         waitForSignal(signal);
         
@@ -116,13 +113,10 @@
 
     public void testCreateDirectoryDetection() throws Exception {
         start();
-        
-        log.debug("creating dir");
 
-        final File newDirectory = new File(directory, "directory");
-        assertTrue(newDirectory.mkdir());
-        assertTrue(newDirectory.exists());
-        assertTrue(newDirectory.isDirectory());
+        delay();
+
+        createDirectory("dir");
         
         waitForSignal(signal);
         
@@ -133,13 +127,10 @@
 
     public void testDeleteFileDetection() throws Exception {
         start();
+
+        delay();
         
-        log.debug("creating file");
-        
-        final File file = new File(directory, "file");
-        writeFile(file, "file");
-        assertTrue(file.exists());
-        assertTrue(file.isFile());
+        final File file = writeFile("file", "file");
         
         waitForSignal(signal);
         
@@ -157,13 +148,10 @@
 
     public void testDeleteDirectoryDetection() throws Exception {
         start();
-        
-        log.debug("creating dir");
 
-        final File newDirectory = new File(directory, "directory");
-        assertTrue(newDirectory.mkdir());
-        assertTrue(newDirectory.exists());
-        assertTrue(newDirectory.isDirectory());
+        delay();
+        
+        final File dir = createDirectory("dir");
         
         waitForSignal(signal);
         
@@ -171,8 +159,10 @@
 
         waitForSignal(signal);
 
-        newDirectory.delete();
-        assertTrue(!newDirectory.exists());
+        delay();
+        
+        dir.delete();
+        assertTrue(!dir.exists());
 
         waitForSignal(signal);
         
@@ -183,13 +173,10 @@
 
     public void testModifyFileDetection() throws Exception {
         start();
+
+        delay();
         
-        log.debug("creating file");
-        
-        final File file = new File(directory, "file");
-        writeFile(file, "file");
-        assertTrue(file.exists());
-        assertTrue(file.isFile());
+        writeFile("file", "file");
         
         waitForSignal(signal);
         
@@ -197,7 +184,7 @@
 
         waitForSignal(signal);
 
-        writeFile(file, "changed file");
+        writeFile("file", "changed file");
 
         waitForSignal(signal);
         
@@ -208,56 +195,46 @@
 
     public void testCreatingLocalDirectoryChangesLastModified() throws Exception {
         final long modified = directory.lastModified();
+
+        delay();
         
-        final File newDirectory = new File(directory, "directory");
-        assertTrue(newDirectory.mkdir());
-        assertTrue(newDirectory.exists());
-        assertTrue(newDirectory.isDirectory());
-        
+        createDirectory("directory");
+               
         assertTrue(directory.lastModified() != modified);
     }
 
     public void testCreatingLocalFileChangesLastModified() throws Exception {
         final long modified = directory.lastModified();
-        
-        final File file = new File(directory, "file");
-        writeFile(file, "file");
-        assertTrue(file.exists());
-        assertTrue(file.isFile());
+
+        delay();
+
+        writeFile("file", "file");
 
         assertTrue(directory.lastModified() != modified);
     }
 
     public void testCreatingSubDirectoryChangesLastModified() throws Exception {
-        final File newDirectory = new File(directory, "directory");
-        assertTrue(newDirectory.mkdir());
-        assertTrue(newDirectory.exists());
-        assertTrue(newDirectory.isDirectory());
+        createDirectory("dir");
 
         final long modified = directory.lastModified();
-        
-        final File newSubDirectory = new File(newDirectory, "sub");
-        assertTrue(newSubDirectory.mkdir());
-        assertTrue(newSubDirectory.exists());
-        assertTrue(newSubDirectory.isDirectory());
 
-        assertTrue(directory.lastModified() != modified);
+        delay();
+
+        createDirectory("dir/sub");
+
+        assertTrue(directory.lastModified() == modified);
     }
 
     public void testCreatingFileInSubDirectoryChangesLastModified() throws Exception {
-        final File newDirectory = new File(directory, "directory");
-        assertTrue(newDirectory.mkdir());
-        assertTrue(newDirectory.exists());
-        assertTrue(newDirectory.isDirectory());
+        createDirectory("dir");
 
         final long modified = directory.lastModified();
-        
-        final File file = new File(newDirectory, "file");
-        writeFile(file, "file");
-        assertTrue(file.exists());
-        assertTrue(file.isFile());
 
-        assertTrue(directory.lastModified() != modified);
+        delay();
+                
+        writeFile("dir/file", "file");
+
+        assertTrue(directory.lastModified() == modified);
     }
     
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message