r752 - in trunk/lutinjaxx/maven/src/test/java: jaxx org/codelutin/jaxx
Author: tchemit Date: 2008-07-22 15:39:01 +0000 (Tue, 22 Jul 2008) New Revision: 752 Added: trunk/lutinjaxx/maven/src/test/java/org/codelutin/jaxx/CompileConfig.java trunk/lutinjaxx/maven/src/test/java/org/codelutin/jaxx/CompilerTest.java Removed: trunk/lutinjaxx/maven/src/test/java/jaxx/CompileConfig.java trunk/lutinjaxx/maven/src/test/java/jaxx/CompilerTest.java Log: move to our package org.codelutin.jaxx Deleted: trunk/lutinjaxx/maven/src/test/java/jaxx/CompileConfig.java =================================================================== --- trunk/lutinjaxx/maven/src/test/java/jaxx/CompileConfig.java 2008-07-22 15:38:42 UTC (rev 751) +++ trunk/lutinjaxx/maven/src/test/java/jaxx/CompileConfig.java 2008-07-22 15:39:01 UTC (rev 752) @@ -1,42 +0,0 @@ -/* -* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, -* Tony Chemit -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* ##% */ -package jaxx; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Une annotation pour configurer les tests de compilation. - * - * @author chemit - */ -@Retention(java.lang.annotation.RetentionPolicy.RUNTIME) -@Target(value = {java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD}) -public @interface CompileConfig { - - public String packageName(); - - public boolean optimize() default true; - - public boolean runJavac() default false; - - public boolean verbose() default false; - - public String javaOpts() default ""; -} Deleted: trunk/lutinjaxx/maven/src/test/java/jaxx/CompilerTest.java =================================================================== --- trunk/lutinjaxx/maven/src/test/java/jaxx/CompilerTest.java 2008-07-22 15:38:42 UTC (rev 751) +++ trunk/lutinjaxx/maven/src/test/java/jaxx/CompilerTest.java 2008-07-22 15:39:01 UTC (rev 752) @@ -1,132 +0,0 @@ -package jaxx; - -import junit.framework.TestCase; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.codelutin.jaxx.JaxxGeneratorGoal; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -public class CompilerTest extends TestCase { - - protected JaxxGeneratorGoal goal; - - protected static final String PREFIX_PACKAGE = "testcases"; - - protected static File srcDir; - - protected static File getSrcDir() { - if (srcDir == null) { - srcDir = new File("src" + File.separator + "test" + File.separator + "java"); - } - return srcDir; - } - - protected static File outDir; - - protected static File getOutDir() { - if (outDir == null) { - outDir = new File("target" + File.separator + "test-gen-java"); - outDir.mkdirs(); - } - return outDir; - } - - protected static File ClassOutDir; - - protected static File getClassOutDir() { - if (ClassOutDir == null) { - ClassOutDir = new File("target" + File.separator + "test-classes"); - ClassOutDir.mkdirs(); - } - return ClassOutDir; - } - - @Override - public void setUp() throws IOException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, MojoExecutionException, MojoFailureException { - CompileConfig anno = getClass().getMethod(getName()).getAnnotation(CompileConfig.class); - assertNotNull("could not found " + CompileConfig.class.getSimpleName() + " annotation on test " + getClass(), anno); - final File srcDir = getSrcDir(); - assertTrue("could not found srcDir (or not existing) : " + srcDir + " on test " + getClass(), srcDir != null && srcDir.exists()); - final File outDir = getOutDir(); - assertTrue("could not found outDir (or not existing) : " + outDir + " on test " + getClass(), outDir != null && outDir.exists()); - final File classOutDir = getClassOutDir(); - assertTrue("could not found classOutDir (or not existing) : " + classOutDir + " on test " + getClass(), classOutDir != null && classOutDir.exists()); - String packageName = anno.packageName(); - goal = new JaxxGeneratorGoal(); - goal.setSrc(srcDir); - goal.setOut(outDir); - goal.setClassOut(classOutDir); - goal.setIncludes(new String[]{"**\\/" + PREFIX_PACKAGE + "\\/" + packageName + "\\/*.jaxx"}); - goal.setOptimize(anno.optimize()); - goal.setVerbose(anno.verbose()); - //TODO Use the maven plexus TestCase inorder to include dependencies - goal.setJavaOpts(anno.javaOpts()); - System.out.println(getName()); - - } - - @CompileConfig(packageName = "InnerClasses", runJavac = true) - public void testInnerClasses() throws MojoExecutionException, MojoFailureException { - goal.execute(); - } - - - @CompileConfig(packageName = "SpecialSubclassing", runJavac = true) - public void testSpecialSubclassing() throws MojoExecutionException, MojoFailureException { - try { - goal.execute(); - } catch (Exception e) { - // there is some inter-dependances between generated java file - // we runJavaC on each file, but we should compile a sourcePath instead... - assertTrue(true); - } - goal.execute(); - } - - @CompileConfig(packageName = "CssTests") - public void testCssTests() throws MojoExecutionException, MojoFailureException { - goal.execute(); - } - - @CompileConfig(packageName = "errors") - public void testErrors() throws MojoExecutionException, MojoFailureException { - } - - @CompileConfig(packageName = "Initializers", runJavac = false) - public void testInitializers() throws MojoExecutionException, MojoFailureException { - goal.execute(); - } - - @CompileConfig(packageName = "Script", runJavac = false) - public void testScript() throws MojoExecutionException, MojoFailureException { - try { - goal.execute(); - } catch (Exception e) { - // there is some inter-dependances between generated java file - // we runJavaC on each file, but we should compile a sourcePath instead... - assertTrue(true); - } - } - - @CompileConfig(packageName = "OverridingDataBindings", runJavac = false) - public void testOverridingDataBindings() throws MojoExecutionException, MojoFailureException { - goal.execute(); - } - - @CompileConfig(packageName = "ClassReferences", runJavac = true) - public void testClassReferences() throws MojoExecutionException, MojoFailureException { - try { - goal.execute(); - } catch (Exception e) { - // there is some inter-dependances between generated java file - // we runJavaC on each file, but we should compile a sourcePath instead... - assertTrue(true); - } - goal.execute(); - } - - -} \ No newline at end of file Copied: trunk/lutinjaxx/maven/src/test/java/org/codelutin/jaxx/CompileConfig.java (from rev 740, trunk/lutinjaxx/maven/src/test/java/jaxx/CompileConfig.java) =================================================================== --- trunk/lutinjaxx/maven/src/test/java/org/codelutin/jaxx/CompileConfig.java (rev 0) +++ trunk/lutinjaxx/maven/src/test/java/org/codelutin/jaxx/CompileConfig.java 2008-07-22 15:39:01 UTC (rev 752) @@ -0,0 +1,42 @@ +/* +* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, +* Tony Chemit +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package org.codelutin.jaxx; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Une annotation pour configurer les tests de compilation. + * + * @author chemit + */ +@Retention(java.lang.annotation.RetentionPolicy.RUNTIME) +@Target(value = {java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD}) +public @interface CompileConfig { + + public String packageName(); + + public boolean optimize() default true; + + public boolean runJavac() default false; + + public boolean verbose() default false; + + public String javaOpts() default ""; +} Copied: trunk/lutinjaxx/maven/src/test/java/org/codelutin/jaxx/CompilerTest.java (from rev 750, trunk/lutinjaxx/maven/src/test/java/jaxx/CompilerTest.java) =================================================================== --- trunk/lutinjaxx/maven/src/test/java/org/codelutin/jaxx/CompilerTest.java (rev 0) +++ trunk/lutinjaxx/maven/src/test/java/org/codelutin/jaxx/CompilerTest.java 2008-07-22 15:39:01 UTC (rev 752) @@ -0,0 +1,131 @@ +package org.codelutin.jaxx; + +import junit.framework.TestCase; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + +public class CompilerTest extends TestCase { + + protected JaxxGeneratorGoal goal; + + protected static final String PREFIX_PACKAGE = "testcases"; + + protected static File srcDir; + + protected static File getSrcDir() { + if (srcDir == null) { + srcDir = new File("src" + File.separator + "test" + File.separator + "java"); + } + return srcDir; + } + + protected static File outDir; + + protected static File getOutDir() { + if (outDir == null) { + outDir = new File("target" + File.separator + "test-gen-java"); + outDir.mkdirs(); + } + return outDir; + } + + protected static File ClassOutDir; + + protected static File getClassOutDir() { + if (ClassOutDir == null) { + ClassOutDir = new File("target" + File.separator + "test-classes"); + ClassOutDir.mkdirs(); + } + return ClassOutDir; + } + + @Override + public void setUp() throws IOException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, MojoExecutionException, MojoFailureException { + CompileConfig anno = getClass().getMethod(getName()).getAnnotation(CompileConfig.class); + assertNotNull("could not found " + CompileConfig.class.getSimpleName() + " annotation on test " + getClass(), anno); + final File srcDir = getSrcDir(); + assertTrue("could not found srcDir (or not existing) : " + srcDir + " on test " + getClass(), srcDir != null && srcDir.exists()); + final File outDir = getOutDir(); + assertTrue("could not found outDir (or not existing) : " + outDir + " on test " + getClass(), outDir != null && outDir.exists()); + final File classOutDir = getClassOutDir(); + assertTrue("could not found classOutDir (or not existing) : " + classOutDir + " on test " + getClass(), classOutDir != null && classOutDir.exists()); + String packageName = anno.packageName(); + goal = new JaxxGeneratorGoal(); + goal.setSrc(srcDir); + goal.setOut(outDir); + goal.setClassOut(classOutDir); + goal.setIncludes(new String[]{"**\\/" + PREFIX_PACKAGE + "\\/" + packageName + "\\/*.jaxx"}); + goal.setOptimize(anno.optimize()); + goal.setVerbose(anno.verbose()); + //TODO Use the maven plexus TestCase inorder to include dependencies + goal.setJavaOpts(anno.javaOpts()); + System.out.println(getName()); + + } + + @CompileConfig(packageName = "InnerClasses", runJavac = true) + public void testInnerClasses() throws MojoExecutionException, MojoFailureException { + goal.execute(); + } + + + @CompileConfig(packageName = "SpecialSubclassing", runJavac = true) + public void testSpecialSubclassing() throws MojoExecutionException, MojoFailureException { + try { + goal.execute(); + } catch (Exception e) { + // there is some inter-dependances between generated java file + // we runJavaC on each file, but we should compile a sourcePath instead... + assertTrue(true); + } + goal.execute(); + } + + @CompileConfig(packageName = "CssTests") + public void testCssTests() throws MojoExecutionException, MojoFailureException { + goal.execute(); + } + + @CompileConfig(packageName = "errors") + public void testErrors() throws MojoExecutionException, MojoFailureException { + } + + @CompileConfig(packageName = "Initializers", runJavac = false) + public void testInitializers() throws MojoExecutionException, MojoFailureException { + goal.execute(); + } + + @CompileConfig(packageName = "Script", runJavac = false) + public void testScript() throws MojoExecutionException, MojoFailureException { + try { + goal.execute(); + } catch (Exception e) { + // there is some inter-dependances between generated java file + // we runJavaC on each file, but we should compile a sourcePath instead... + assertTrue(true); + } + } + + @CompileConfig(packageName = "OverridingDataBindings", runJavac = false) + public void testOverridingDataBindings() throws MojoExecutionException, MojoFailureException { + goal.execute(); + } + + @CompileConfig(packageName = "ClassReferences", runJavac = true) + public void testClassReferences() throws MojoExecutionException, MojoFailureException { + try { + goal.execute(); + } catch (Exception e) { + // there is some inter-dependances between generated java file + // we runJavaC on each file, but we should compile a sourcePath instead... + assertTrue(true); + } + goal.execute(); + } + + +} \ No newline at end of file
participants (1)
-
tchemit@users.labs.libre-entreprise.org