commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r232289 - in /jakarta/commons/sandbox/jci/trunk/src: java/org/apache/commons/jci/ java/org/apache/commons/jci/compilers/ java/org/apache/commons/jci/listeners/ java/org/apache/commons/jci/monitor/ test/org/apache/commons/jci/ test/org/apach...
Date Fri, 12 Aug 2005 13:43:45 GMT
Author: tcurdt
Date: Fri Aug 12 06:43:32 2005
New Revision: 232289

URL: http://svn.apache.org/viewcvs?rev=232289&view=rev
Log:
more tests,
fixed some license headers


Modified:
    jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/CompilingClassLoader.java
    jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
    jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
    jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/CompilingListener.java
    jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/ReloadingListener.java
    jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitor.java
    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/ReloadingClassLoaderTestCase.java
    jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/compilers/JavaCompilerFactoryTestCase.java
    jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java
    jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/stores/MemoryResourceStoreTestCase.java

Modified: jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/CompilingClassLoader.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/CompilingClassLoader.java?rev=232289&r1=232288&r2=232289&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/CompilingClassLoader.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/CompilingClassLoader.java
Fri Aug 12 06:43:32 2005
@@ -20,6 +20,7 @@
 import org.apache.commons.jci.compilers.eclipse.EclipseJavaCompiler;
 import org.apache.commons.jci.listeners.CompilingListener;
 import org.apache.commons.jci.monitor.FilesystemAlterationMonitor;
+import org.apache.commons.jci.problems.ConsoleCompilationProblemHandler;
 import org.apache.commons.jci.stores.MemoryResourceStore;
 import org.apache.commons.jci.stores.TransactionalResourceStore;
 import org.apache.commons.logging.Log;
@@ -60,7 +61,12 @@
 
     public void start() {
         fam = new FilesystemAlterationMonitor(); 
-        fam.addListener(new CompilingListener(reader,compiler,transactionalStore) {
+        fam.addListener(new CompilingListener(
+                reader,
+                compiler,
+                transactionalStore,
+                new ConsoleCompilationProblemHandler()
+                ) {
             public void reload() {
                 CompilingClassLoader.this.reload();
             }

Modified: jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java?rev=232289&r1=232288&r2=232289&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
Fri Aug 12 06:43:32 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.jci.compilers;
 
 public interface JavaCompilerFactory {

Modified: jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java?rev=232289&r1=232288&r2=232289&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
Fri Aug 12 06:43:32 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.jci.compilers;
 
 

Modified: jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/CompilingListener.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/CompilingListener.java?rev=232289&r1=232288&r2=232289&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/CompilingListener.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/CompilingListener.java
Fri Aug 12 06:43:32 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.jci.listeners;
 
 import java.io.File;
@@ -7,7 +22,7 @@
 import org.apache.commons.jci.ReloadingClassLoader;
 import org.apache.commons.jci.compilers.JavaCompiler;
 import org.apache.commons.jci.monitor.FilesystemAlterationListener;
-import org.apache.commons.jci.problems.ConsoleCompilationProblemHandler;
+import org.apache.commons.jci.problems.CompilationProblemHandler;
 import org.apache.commons.jci.readers.ResourceReader;
 import org.apache.commons.jci.stores.TransactionalResourceStore;
 import org.apache.commons.logging.Log;
@@ -25,15 +40,18 @@
     private final JavaCompiler compiler;
     private final ResourceReader reader;
     private final TransactionalResourceStore transactionalStore;
+    private final CompilationProblemHandler problemHandler;
     
     public CompilingListener(
             final ResourceReader pReader,
             final JavaCompiler pCompiler,
-            final TransactionalResourceStore pTransactionalStore
+            final TransactionalResourceStore pTransactionalStore,
+            final CompilationProblemHandler pProblemHandler
             ) {
         compiler = pCompiler;
         reader = pReader;
         transactionalStore = pTransactionalStore;
+        problemHandler = pProblemHandler;
     }
     
     public void onStart(final File pRepository) {
@@ -74,8 +92,6 @@
                 i++;
             }
             
-            final ConsoleCompilationProblemHandler problemHandler = new ConsoleCompilationProblemHandler();
-
             compiler.compile(
                     clazzes,
                     reader,

Modified: jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/ReloadingListener.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/ReloadingListener.java?rev=232289&r1=232288&r2=232289&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/ReloadingListener.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/listeners/ReloadingListener.java
Fri Aug 12 06:43:32 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.jci.listeners;
 
 import java.io.File;

Modified: jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitor.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitor.java?rev=232289&r1=232288&r2=232289&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitor.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitor.java
Fri Aug 12 06:43:32 2005
@@ -124,11 +124,11 @@
             return file;
         }
 
-
+/*
         public File getRoot() {
             return root;
         }
-
+*/
 
         public void markNotChanged() {
             lastModified = file.lastModified();

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=232289&r1=232288&r2=232289&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:43:32 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.jci;
 
 import java.io.File;

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=232289&r1=232288&r2=232289&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:43:32 2005
@@ -58,6 +58,25 @@
     }
     
     
+    public void testCompileProblems() throws Exception {
+        delay();
+        
+        waitForSignal(reload);
+
+        writeFile("jci/Simple.java",
+                "package jci;\n"
+                + "public class Simple { \n"
+                + "  public String toString() { \n"
+                + "    return 1; \n"
+                + "  } \n"
+                + "} \n"
+        );
+
+        waitForSignal(reload);
+        
+        
+    }
+    
     public void testCreate() throws Exception {
         initialCompile();
         

Modified: jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/ReloadingClassLoaderTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/ReloadingClassLoaderTestCase.java?rev=232289&r1=232288&r2=232289&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/ReloadingClassLoaderTestCase.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/ReloadingClassLoaderTestCase.java
Fri Aug 12 06:43:32 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.jci;
 
 import java.io.File;

Modified: jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/compilers/JavaCompilerFactoryTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/compilers/JavaCompilerFactoryTestCase.java?rev=232289&r1=232288&r2=232289&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/compilers/JavaCompilerFactoryTestCase.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/compilers/JavaCompilerFactoryTestCase.java
Fri Aug 12 06:43:32 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.jci.compilers;
 
 import junit.framework.TestCase;

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=232289&r1=232288&r2=232289&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:43:32 2005
@@ -1,6 +1,22 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.jci.monitor;
 
 import java.io.File;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.jci.AbstractTestCase;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -152,21 +168,22 @@
         delay();
         
         final File dir = createDirectory("dir");
+        createDirectory("dir/sub");
         
         waitForSignal(signal);
         
-        assertTrue(listener.createdDirs == 1);
+        assertTrue(listener.createdDirs == 2);
 
         waitForSignal(signal);
 
         delay();
         
-        dir.delete();
+        FileUtils.deleteDirectory(dir);
         assertTrue(!dir.exists());
 
         waitForSignal(signal);
         
-        assertTrue(listener.deletedDirs == 1);
+        assertTrue(listener.deletedDirs == 2);
 
         stop();
     }

Modified: jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/stores/MemoryResourceStoreTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/stores/MemoryResourceStoreTestCase.java?rev=232289&r1=232288&r2=232289&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/stores/MemoryResourceStoreTestCase.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/src/test/org/apache/commons/jci/stores/MemoryResourceStoreTestCase.java
Fri Aug 12 06:43:32 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.jci.stores;
 
 import junit.framework.TestCase;
@@ -6,6 +21,32 @@
 public final class MemoryResourceStoreTestCase extends TestCase {
 
     public void testStoring() {
+        final ResourceStore store = new MemoryResourceStore();
+
+        final byte[] data = { 1, 2, 3 };
+        store.write("key", data);
+        
+        final byte[] read = store.read("key");
+        
+        assertTrue(read == data);
+        assertTrue(read.equals(data));
+    }
+    
+    public void testRemoving() {
+        final ResourceStore store = new MemoryResourceStore();
+
+        final byte[] data = { 1, 2, 3 };
+        store.write("key", data);
+        
+        final byte[] read = store.read("key");
+        
+        assertTrue(read == data);
+        assertTrue(read.equals(data));
+
+        store.remove("key");
+
+        final byte[] empty = store.read("key");
         
+        assertTrue(empty == null);
     }
 }



---------------------------------------------------------------------
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