Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 77290 invoked from network); 12 Aug 2005 13:43:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Aug 2005 13:43:54 -0000 Received: (qmail 62663 invoked by uid 500); 12 Aug 2005 13:43:50 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 62585 invoked by uid 500); 12 Aug 2005 13:43:50 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 62572 invoked by uid 500); 12 Aug 2005 13:43:50 -0000 Received: (qmail 62569 invoked by uid 99); 12 Aug 2005 13:43:50 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 12 Aug 2005 06:43:49 -0700 Received: (qmail 77242 invoked by uid 65534); 12 Aug 2005 13:43:49 -0000 Message-ID: <20050812134349.77241.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commons-cvs@jakarta.apache.org From: tcurdt@apache.org X-Mailer: svnmailer-1.0.3 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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