myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhue...@apache.org
Subject svn commit: r910053 [2/2] - in /myfaces/extensions/scripting/branches/1_1/core: core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/ core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/ core/src/main/java/org/apach...
Date Sun, 14 Feb 2010 17:44:12 GMT
Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/OverridingClassLoader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/OverridingClassLoader.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/OverridingClassLoader.java
(added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/OverridingClassLoader.java
Sun Feb 14 17:44:11 2010
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.myfaces.extensions.scripting.loader.support;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * <p>A reloadable class loader implementation that you can use to forcefully reload
classes
+ * even if you don't want to recompile them and hence haven't got the actual .class file.
Use
+ * this class loader if you want to reload a class that depends on a dynamically compiled
+ * class, for example, in case of Spring if you've got a factory bean constructing bean
+ * instances of a dynamically compiled class. Once the dynamically compiled class changes,
+ * the class of the factory bean has to be reloaded as well even though it somehow didn't
+ * really change.</p>
+ */
+public class OverridingClassLoader extends AbstractThrowAwayClassLoader {
+
+    // ------------------------------------------ Constructors
+
+    /**
+     * <p>Constructs a new overriding class loader using the name of the class that
+     * it's going to override and the parent class loader. Note that this class loader
+     * only loads the class definition for the given class name. Otherwise it will
+     * delegate to the parent class loader.</p>
+     *
+     * @param className the name of the class that it's going to override
+     * @param parent    the parent class loader
+     */
+    public OverridingClassLoader(String className, ClassLoader parent) {
+        super(className, parent);
+    }
+
+    // ------------------------------------------ AbstractThrowAwayClassLoader methods
+
+    /**
+     * <p>Opens a stream to the resource that defines the given class using the parent
+     * class loader. If it cannot be found, return <code>null</code>.</p>
+     *
+     * @param className the class to load
+     * @return a stream to the resource that defines the given class
+     * @throws IOException if an I/O error occurs
+     */
+    protected InputStream openStreamForClass(String className) throws IOException {
+        return getParent().getResourceAsStream(className.replace('.', '/') + ".class");
+    }
+
+}

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/OverridingClassLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/OverridingClassLoader.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ThrowAwayClassLoader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ThrowAwayClassLoader.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ThrowAwayClassLoader.java
(added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ThrowAwayClassLoader.java
Sun Feb 14 17:44:11 2010
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.myfaces.extensions.scripting.loader.support;
+
+/**
+ * <p>A class loader that implements this interface is able to throw away class definitions.
+ * Well, to be more precise, no class loader is really able to do that, but you can get this
+ * behaviour by just throwing away this class loader. Note that a class loader implementing
+ * this interface is supposed to load just a single class definition, i.e. there's a 1:1
+ * relationship between the class loader and the class. In doing so, we're somehow able to
+ * throw away class definitions and replace them with newer versions.</p>
+ */
+public interface ThrowAwayClassLoader {
+
+    /**
+     * <p>Loads the class with the specified class name. However, note that implementing
+     * classes are just supposed to load a single class, so if you want to load a different
+     * class than that, this class loader will just delegate to the parent class loader.</p>
+     *
+     * @param className the name of the class you want to load
+     * @param resolve   if <tt>true</tt> then resolve the class
+     * @return the resulting Class reference
+     * @throws ClassNotFoundException if the class could not be found
+     */
+    public Class loadClass(String className, boolean resolve) throws ClassNotFoundException;
+
+    /**
+     * <p>Returns <code>true</code> if the given "last modified"-timestamp
is
+     * more recent than the timestamp of this ClassLoader, i.e. if this ClassLoader
+     * is to be destroyed as there is a newer class file available.
+     *
+     * @param lastModified the "last modified"-timestamp of the class file you want to load
+     * @return <code>true</code> if the given "last modified"-timestamp is
+     *         more recent than the timestamp of this class loader
+     */
+    public boolean isOutdated(long lastModified);
+
+}
\ No newline at end of file

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ThrowAwayClassLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ThrowAwayClassLoader.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/Compiler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/Compiler.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/Compiler.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/Compiler.java
Sun Feb 14 17:44:11 2010
@@ -18,7 +18,8 @@
  */
 package org.apache.myfaces.scripting.api;
 
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationException;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
 
 import java.io.File;
 
@@ -38,10 +39,10 @@
      * @param file        the file of the class you want to compile
      * @param classLoader the class loader for dependent classes
      * @return the compilation result, i.e. the compiler output, a list of errors and a list
of warnings
-     * @throws org.apache.myfaces.scripting.api.CompilationException if a severe error occured
while trying to compile a file
+     * @throws org.apache.myfaces.extensions.scripting.compiler.CompilationException if a
severe error occured while trying to compile a file
      */
     public CompilationResult compile(File sourcePath, File targetPath, File file, ClassLoader
classLoader)
-            throws org.apache.myfaces.scripting.api.CompilationException;
+            throws CompilationException;
 
     /**
      * <p>Compiles the given file and creates an according class file in the given
target path. Note that
@@ -53,9 +54,9 @@
      * @param targetPath  the path to the target directory
      * @param classLoader the class loader for dependent classes
      * @return the compilation result, i.e. the compiler output, a list of errors and a list
of warnings
-     * @throws org.apache.myfaces.scripting.api.CompilationException if a severe error occurred
while trying to compile a file
+     * @throws org.apache.myfaces.extensions.scripting.compiler.CompilationException if a
severe error occurred while trying to compile a file
      */
     public CompilationResult compile(File sourcePath, File targetPath,  ClassLoader classLoader)
-            throws org.apache.myfaces.scripting.api.CompilationException;
+            throws CompilationException;
 
 }

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/components/CompilerComponentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/components/CompilerComponentRenderer.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/components/CompilerComponentRenderer.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/components/CompilerComponentRenderer.java
Sun Feb 14 17:44:11 2010
@@ -21,7 +21,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
 import org.apache.myfaces.scripting.api.ScriptingConst;
 import org.apache.myfaces.scripting.core.util.WeavingContext;
 import org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase;

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanUtils.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanUtils.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanUtils.java
Sun Feb 14 17:44:11 2010
@@ -18,6 +18,8 @@
  */
 package org.apache.myfaces.scripting.core.dependencyScan;
 
+import org.objectweb.asm.Type;
+
 import java.util.Collection;
 import java.util.Set;
 

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java
Sun Feb 14 17:44:11 2010
@@ -20,7 +20,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
 import org.apache.myfaces.scripting.api.Configuration;
 import org.apache.myfaces.scripting.api.Decorated;
 import org.apache.myfaces.scripting.api.ScriptingConst;

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompiler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompiler.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompiler.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompiler.java
Sun Feb 14 17:44:11 2010
@@ -20,9 +20,10 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.api.CompilationException;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
-import org.apache.myfaces.scripting.sandbox.loader.ClassLoaderUtils;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationException;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.compiler.Compiler;
+import org.apache.myfaces.extensions.scripting.loader.ClassLoaderUtils;
 import org.apache.myfaces.scripting.api.*;
 import org.apache.myfaces.scripting.core.util.FileUtils;
 import org.apache.myfaces.scripting.core.util.WeavingContext;
@@ -43,7 +44,7 @@
 /**
  * <p>A compiler implementation that can be used to compile Groovy source files.</p>
  */
-public class GroovyCompiler  implements org.apache.myfaces.scripting.sandbox.compiler.Compiler
{
+public class GroovyCompiler  implements Compiler {
 
     /**
      * The logger instance for this class.

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompilerFacade.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompilerFacade.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompilerFacade.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompilerFacade.java
Sun Feb 14 17:44:11 2010
@@ -20,8 +20,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
-import org.apache.myfaces.scripting.sandbox.compiler.GroovyCompiler;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.compiler.GroovyCompiler;
 import org.apache.myfaces.scripting.api.DynamicCompiler;
 import org.apache.myfaces.scripting.api.ScriptingConst;
 import org.apache.myfaces.scripting.core.util.ClassUtils;
@@ -110,7 +110,7 @@
     public File compileAllFiles(String sourceRoot, String classPath) throws ClassNotFoundException
{
         GroovyRecompiledClassloader classLoader = new GroovyRecompiledClassloader(ClassUtils.getContextClassLoader(),
ScriptingConst.ENGINE_TYPE_GROOVY, ".groovy");
         classLoader.setSourceRoot(sourceRoot);
-        CompilationResult result = compiler.compile(new File(sourceRoot), WeavingContext.getConfiguration().getCompileTarget(),
classLoader);
+        CompilationResult result = null; //compiler.compile(new File(sourceRoot), WeavingContext.getConfiguration().getCompileTarget(),
classLoader);
 
         displayMessages(result);
         return WeavingContext.getConfiguration().getCompileTarget();

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/CompilerFacade.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/CompilerFacade.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/CompilerFacade.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/CompilerFacade.java
Sun Feb 14 17:44:11 2010
@@ -20,14 +20,14 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.api.CompilationException;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationException;
 import org.apache.myfaces.scripting.api.DynamicCompiler;
 import org.apache.myfaces.scripting.api.ScriptingConst;
 import org.apache.myfaces.scripting.core.util.ClassUtils;
 import org.apache.myfaces.scripting.core.util.FileUtils;
 import org.apache.myfaces.scripting.core.util.WeavingContext;
 import org.apache.myfaces.scripting.loaders.java.RecompiledClassLoader;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
 
 import java.io.File;
 
@@ -77,7 +77,7 @@
                 log.error("Compiler output:" + result.getCompilerOutput());
             }
 
-        } catch (org.apache.myfaces.scripting.api.CompilationException e) {
+        } catch (CompilationException e) {
             log.error(e);
         }
     }

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/JavacCompiler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/JavacCompiler.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/JavacCompiler.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/JavacCompiler.java
Sun Feb 14 17:44:11 2010
@@ -20,8 +20,9 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
-import org.apache.myfaces.scripting.sandbox.loader.ClassLoaderUtils;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationException;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.loader.ClassLoaderUtils;
 import org.apache.myfaces.scripting.api.*;
 import org.apache.myfaces.scripting.core.util.ClassUtils;
 import org.apache.myfaces.scripting.core.util.FileUtils;

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/AbstractGeneratorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/AbstractGeneratorTestCase.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/AbstractGeneratorTestCase.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/AbstractGeneratorTestCase.java
Sun Feb 14 17:44:11 2010
@@ -19,10 +19,10 @@
 package org.apache.myfaces.extensions.scripting;
 
 import junit.framework.TestCase;
-import org.apache.myfaces.scripting.api.CompilationException;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
-import org.apache.myfaces.scripting.sandbox.compiler.Compiler;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilerFactory;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationException;
+import org.apache.myfaces.extensions.scripting.compiler.Compiler;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.compiler.CompilerFactory;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -128,7 +128,7 @@
                 new File(buildAbsolutePath(sourcePath)), new File(buildAbsolutePath(targetPath)),
fileName, fileContent, classLoader);
     }
 
-    protected CompilationResult compileFile(Compiler compiler, String sourcePath, String
targetPath, String fileName, String[] fileContent)
+    protected CompilationResult compileFile(org.apache.myfaces.extensions.scripting.compiler.Compiler
compiler, String sourcePath, String targetPath, String fileName, String[] fileContent)
             throws IOException, CompilationException {
         return compileFile(compiler,
                 new File(buildAbsolutePath(sourcePath)), new File(buildAbsolutePath(targetPath)),
fileName, fileContent);

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/groovyCompiler/GroovyCompilerTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/groovyCompiler/GroovyCompilerTest.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/groovyCompiler/GroovyCompilerTest.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/groovyCompiler/GroovyCompilerTest.java
Sun Feb 14 17:44:11 2010
@@ -19,9 +19,9 @@
 package org.apache.myfaces.extensions.scripting.groovyCompiler;
 
 import org.apache.commons.io.FilenameUtils;
-import org.apache.myfaces.scripting.api.CompilationException;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
-import org.apache.myfaces.scripting.sandbox.compiler.GroovyCompiler;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationException;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.compiler.GroovyCompiler;
 import org.apache.myfaces.scripting.core.util.FileUtils;
 import org.junit.Test;
 
@@ -107,7 +107,7 @@
         target.mkdirs();
         target.deleteOnExit();
 
-        CompilationResult result = compiler.compile(root, target, loader);
+        CompilationResult result = null; // compiler.compile(root, target, loader);
 
         assertTrue("result has no errors", !result.hasErrors());
 

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistryTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistryTest.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistryTest.java
(added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistryTest.java
Sun Feb 14 17:44:11 2010
@@ -0,0 +1,35 @@
+package org.apache.myfaces.extensions.scripting.loader.dependencies.registry;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>Test class for
+ * <code>org.apache.myfaces.extensions.scripting.loader.dependencies.registry.DefaultDependencyRegistry</code>.</p>
+ *
+ * @author Bernhard Huemer
+ */
+public class DefaultDependencyRegistryTest extends TestCase {
+
+    // ------------------------------------------ Test methods
+
+    /**
+     * <p>Tests whether the registry stores dependencies and dependent classes correctly.
Just
+     * consider this test case as some kind of example of what I mean with "dependent classes"
+     * and "dependencies".</p>
+     * 
+     */
+    public void testRegisterDependencies() {
+        DefaultDependencyRegistry registry = new DefaultDependencyRegistry();
+        registry.registerDependency("com.foo.Bar", "com.foo.Bla");
+        registry.registerDependency("com.foo.Bar", "com.foo.Blubb");
+
+        assertEquals(1, registry.getDependentClasses("com.foo.Bla").size());
+        assertTrue(registry.getDependentClasses("com.foo.Bla").contains("com.foo.Bar"));
+
+        assertEquals(1, registry.getDependentClasses("com.foo.Blubb").size());
+        assertTrue(registry.getDependentClasses("com.foo.Blubb").contains("com.foo.Bar"));
+
+        assertEquals(0, registry.getDependentClasses("com.foo.Bar").size());
+    }
+
+}

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/core/classIdentifier/DynamicClassloader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/core/classIdentifier/DynamicClassloader.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/core/classIdentifier/DynamicClassloader.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/core/classIdentifier/DynamicClassloader.java
Sun Feb 14 17:44:11 2010
@@ -18,7 +18,7 @@
  */
 package org.apache.myfaces.scripting.core.classIdentifier;
 
-import org.apache.myfaces.scripting.sandbox.loader.support.ThrowAwayClassLoader;
+import org.apache.myfaces.extensions.scripting.loader.support.ThrowAwayClassLoader;
 import org.apache.myfaces.scripting.core.util.ClassUtils;
 import org.apache.myfaces.scripting.loaders.java.JavaThrowAwayClassloader;
 

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/AbstractJavaCompilerTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/AbstractJavaCompilerTestCase.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/AbstractJavaCompilerTestCase.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/AbstractJavaCompilerTestCase.java
Sun Feb 14 17:44:11 2010
@@ -21,13 +21,13 @@
 import java.io.File;
 
 import org.apache.myfaces.extensions.scripting.AbstractGeneratorTestCase;
-import org.apache.myfaces.scripting.sandbox.compiler.*;
-import org.apache.myfaces.scripting.sandbox.compiler.Compiler;
+import org.apache.myfaces.extensions.scripting.compiler.*;
+import org.apache.myfaces.extensions.scripting.compiler.Compiler;
 import org.junit.Ignore;
 
 /**
  * <p>Test class for all Java implementations of
- * <code>org.apache.myfaces.scripting.sandbox.compiler.Compiler</code>.</p>
+ * <code>org.apache.myfaces.extensions.scripting.compiler.Compiler</code>.</p>
  */
 @Ignore
 public abstract class AbstractJavaCompilerTestCase extends AbstractGeneratorTestCase {
@@ -46,7 +46,7 @@
                 "}                                                  "
         });
 
-        org.apache.myfaces.scripting.sandbox.compiler.Compiler compiler = createCompiler();
+        Compiler compiler = createCompiler();
         CompilationResult result = compiler.compile(
                 new File(buildAbsolutePath("/src/main/java")),
                 new File(buildAbsolutePath("/target/test-classes")),
@@ -85,8 +85,8 @@
                 "package org.apache.myfaces.extensions.scripting;                       
           ",
                 "                                                                       
           ",
                 "import java.io.File;                                                   
           ",
-                "import org.apache.myfaces.scripting.sandbox.compiler.Compiler;         
        ",
-                "import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
        ",
+                "import org.apache.myfaces.extensions.scripting.compiler.Compiler;      
           ",
+                "import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
        ",
                 "                                                                       
           ",
                 "public class DummyCompiler implements Compiler {                       
           ",
                 "                                                                       
           ",
@@ -117,8 +117,8 @@
                 "package org.apache.myfaces.extensions.scripting;                       
           ",
                 "                                                                       
           ",
                 "import java.io.File;                                                   
           ",
-                "import org.apache.myfaces.scripting.sandbox.compiler.Compiler;         
        ",
-                "import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
        ",
+                "import org.apache.myfaces.extensions.scripting.compiler.Compiler;      
           ",
+                "import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
        ",
                 "                                                                       
           ",
                 "public class DummyCompiler implements Compiler {                       
           ",
                 "                                                                       
           ",
@@ -157,6 +157,6 @@
      *
      * @return a new instance of the compiler implementation that this class should test
      */
-    protected abstract Compiler createCompiler();
+    protected abstract org.apache.myfaces.extensions.scripting.compiler.Compiler createCompiler();
 
 }

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/GroovyCompilerTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/GroovyCompilerTest.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/GroovyCompilerTest.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/GroovyCompilerTest.java
Sun Feb 14 17:44:11 2010
@@ -19,14 +19,15 @@
 package org.apache.myfaces.scripting.sandbox;
 
 import org.apache.myfaces.extensions.scripting.AbstractGeneratorTestCase;
-import org.apache.myfaces.scripting.sandbox.compiler.*;
-import org.apache.myfaces.scripting.sandbox.compiler.Compiler;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
+import org.apache.myfaces.extensions.scripting.compiler.GroovyCompiler;
+import org.apache.myfaces.extensions.scripting.compiler.Compiler;
 
 import java.io.File;
 
 /**
  * <p>Test class for
- * <code>org.apache.myfaces.scripting.sandbox.compiler.GroovyCompiler</code></p>
+ * <code>org.apache.myfaces.extensions.scripting.compiler.GroovyCompiler</code></p>
  */
 public class GroovyCompilerTest extends AbstractGeneratorTestCase {
 
@@ -49,7 +50,7 @@
                 "}                                                  "
         });
 
-        org.apache.myfaces.scripting.sandbox.compiler.Compiler compiler = new GroovyCompiler();
+        Compiler compiler = new GroovyCompiler();
         CompilationResult result = compiler.compile(
                 new File(buildAbsolutePath("/src/main/groovy")),
                 new File(buildAbsolutePath("/target/test-classes")),
@@ -99,8 +100,8 @@
                 "package org.apache.myfaces.extensions.scripting;                       
           ",
                 "                                                                       
           ",
                 "import java.io.File;                                                   
           ",
-                "import org.apache.myfaces.scripting.sandbox.compiler.Compiler;         
        ",
-                "import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
        ",
+                "import org.apache.myfaces.extensions.scripting.compiler.Compiler;      
           ",
+                "import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
        ",
                 "                                                                       
           ",
                 "def class DummyCompiler implements Compiler {                          
           ",
                 "                                                                       
           ",

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/JavacCompilerTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/JavacCompilerTest.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/JavacCompilerTest.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/JavacCompilerTest.java
Sun Feb 14 17:44:11 2010
@@ -18,19 +18,19 @@
  */
 package org.apache.myfaces.scripting.sandbox;
 
-import org.apache.myfaces.scripting.sandbox.compiler.*;
+import org.apache.myfaces.extensions.scripting.compiler.*;
 import org.junit.Ignore;
 
 /**
  * <p>Test class for
- * <code>org.apache.myfaces.scripting.sandbox.compiler.JavacCompiler</code></p>
+ * <code>org.apache.myfaces.extensions.scripting.compiler.JavacCompiler</code></p>
  */
 @Ignore
 public class JavacCompilerTest extends AbstractJavaCompilerTestCase {
 
     // ------------------------------------------ AbstractJavaCompilerTestCase methods
 
-    protected org.apache.myfaces.scripting.sandbox.compiler.Compiler createCompiler() {
+    protected org.apache.myfaces.extensions.scripting.compiler.Compiler createCompiler()
{
         return new JavacCompiler();
     }
 

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/Jsr199CompilerTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/Jsr199CompilerTest.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/Jsr199CompilerTest.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/Jsr199CompilerTest.java
Sun Feb 14 17:44:11 2010
@@ -29,7 +29,7 @@
 
     // ------------------------------------------ AbstractJavaCompilerTestCase methods
 
-    protected org.apache.myfaces.scripting.sandbox.compiler.Compiler createCompiler() {
+    protected org.apache.myfaces.extensions.scripting.compiler.Compiler createCompiler()
{
         //return new Jsr199Compiler();
         return null;
     }

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/OverridingClassLoaderTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/OverridingClassLoaderTest.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/OverridingClassLoaderTest.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/OverridingClassLoaderTest.java
Sun Feb 14 17:44:11 2010
@@ -19,11 +19,11 @@
 package org.apache.myfaces.scripting.sandbox;
 
 import junit.framework.TestCase;
-import org.apache.myfaces.scripting.sandbox.loader.support.OverridingClassLoader;
+import org.apache.myfaces.extensions.scripting.loader.support.OverridingClassLoader;
 
 /**
  * <p>Test class for the class
- * <code>org.apache.myfaces.scripting.sandbox.loader.support.OverridingClassLoader</code></p>
+ * <code>org.apache.myfaces.extensions.scripting.loader.support.OverridingClassLoader</code></p>
  */
 public class OverridingClassLoaderTest extends TestCase {
 

Modified: myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/ReloadingClassLoaderTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/ReloadingClassLoaderTest.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/ReloadingClassLoaderTest.java
(original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/ReloadingClassLoaderTest.java
Sun Feb 14 17:44:11 2010
@@ -19,14 +19,14 @@
 package org.apache.myfaces.scripting.sandbox;
 
 import org.apache.myfaces.extensions.scripting.AbstractGeneratorTestCase;
-import org.apache.myfaces.scripting.sandbox.loader.ReloadingClassLoader;
+import org.apache.myfaces.extensions.scripting.loader.ReloadingClassLoader;
 import org.junit.Ignore;
 
 import java.io.File;
 
 /**
  * <p>Test class for
- * <code>org.apache.myfaces.scripting.sandbox.loader.ReloadingClassLoader</code></p>
+ * <code>org.apache.myfaces.extensions.scripting.loader.ReloadingClassLoader</code></p>
  */
 @Ignore
 public class ReloadingClassLoaderTest extends AbstractGeneratorTestCase {
@@ -197,8 +197,8 @@
                 "package org.apache.myfaces.extensions.scripting;                       
           ",
                 "                                                                       
           ",
                 "import java.io.File;                                                   
           ",
-                "import org.apache.myfaces.scripting.sandbox.compiler.Compiler;         
        ",
-                "import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
        ",
+                "import org.apache.myfaces.extensions.scripting.compiler.Compiler;      
           ",
+                "import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
        ",
                 "                                                                       
           ",
                 "public class DummyCompiler implements Compiler {                       
           ",
                 "                                                                       
           ",
@@ -224,9 +224,9 @@
     public void testLoadParentClassFile() throws Exception {
         ClassLoader classLoader = buildClassLoader("/target/test-classes");
 
-        Class compilerInterface = classLoader.loadClass("org.apache.myfaces.scripting.sandbox.compiler.Compiler");
+        Class compilerInterface = classLoader.loadClass("org.apache.myfaces.extensions.scripting.compiler.Compiler");
         assertNotNull(compilerInterface);
-        assertEquals("org.apache.myfaces.scripting.sandbox.compiler.Compiler", compilerInterface.getName());
+        assertEquals("org.apache.myfaces.extensions.scripting.compiler.Compiler", compilerInterface.getName());
     }
 
     public void testOutdatedCheck() throws Exception {



Mime
View raw message