Property changes on: /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins ___________________________________________________________________ Name: svn:ignore + target Index: /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins/src/main/java/org/codehaus/castor/maven/xmlctf/AbstractTestSuiteMojo.java =================================================================== --- /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins/src/main/java/org/codehaus/castor/maven/xmlctf/AbstractTestSuiteMojo.java (revision 0) +++ /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins/src/main/java/org/codehaus/castor/maven/xmlctf/AbstractTestSuiteMojo.java (revision 0) @@ -0,0 +1,143 @@ +/* + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001-2002 (C) Intalio, Inc. All Rights Reserved. + * + */ +package org.codehaus.castor.maven.xmlctf; + +import java.io.File; +import java.util.Iterator; + +import junit.framework.Test; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.castor.xmlctf.TestCaseAggregator; + +/** + * Abstract Mojo that initialises the junit test cases from xml + * Subclasses implement the runJUnit method to provide the Runner (eg. text, swing, ..) + * + * @requiresProject true + * @requiresDependencyResolution runtime + */ +public abstract class AbstractTestSuiteMojo extends AbstractMojo{ + + private static final String TEST_ROOT_PROPERTY = "castor.xmlctf.root"; + + /** + * The target dir used for the testclasses. + * + * @parameter expression="./target/xmlctf" + */ + private String outputRoot; + + /** + * The source dir of the tests. + * + * @parameter + */ + private String testRoot; + /** + * The project whose project files to create. + * + * @parameter expression="${project}" + * @required + */ + private MavenProject project; + + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("Starting Castor Mastertestsuite"); + + // testRoot checks + String testRootToUse = System.getProperty(TEST_ROOT_PROPERTY); + if (testRootToUse == null) { + testRootToUse = testRoot; + } + + if (testRootToUse == null) { + throw new MojoExecutionException("No testroot found, please specify property -Dcastor.xmlctf.root"); + } + + if (testRootToUse.equals(".") || testRootToUse.equals("..")) { + //-- convert relative directories "." and ".." to a Canonical path + File tmp = new File(testRootToUse); + try { + testRootToUse = tmp.getCanonicalPath(); + } catch (java.io.IOException iox) { + + } + } else if (testRootToUse.startsWith("./") || testRootToUse.startsWith(".\\")) { + //-- Remove leading ./ or .\ -- URLClassLoader can't handle such file URLs + testRoot = testRoot.substring(2); + } + + File testRootFile = new File(testRootToUse); + getLog().info("using testRoot: " + testRootFile.getAbsolutePath()); + + if (!testRootFile.exists()) { + throw new MojoExecutionException("Root not found:" + testRoot); + } + + // set classpath for testcompiler + String classpath = System.getProperty("java.home") + "/lib/tools.jar:"; + for (Iterator iter = project.getArtifacts().iterator(); iter.hasNext();) { + classpath += ((Artifact) iter.next()).getFile().getAbsolutePath() + ":"; + } + + System.setProperty("xmlctf.classpath.override",classpath); + if (getLog().isDebugEnabled()) { + System.setProperty(TestCaseAggregator.VERBOSE_PROPERTY, "true"); + System.setProperty(TestCaseAggregator.PRINT_STACK_TRACE, "true"); + } + + getLog().debug("classpath for sourcegenerator is:" + classpath); + + // run testCase + runJUnit(new TestCaseAggregator(testRootFile, outputRoot).suite()); + } + + public abstract void runJUnit(Test testSuite )throws MojoExecutionException; + +} Index: /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins/src/main/java/org/codehaus/castor/maven/xmlctf/TextTestSuiteMojo.java =================================================================== --- /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins/src/main/java/org/codehaus/castor/maven/xmlctf/TextTestSuiteMojo.java (revision 0) +++ /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins/src/main/java/org/codehaus/castor/maven/xmlctf/TextTestSuiteMojo.java (revision 0) @@ -0,0 +1,72 @@ +/* + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "Exolab" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of Intalio, Inc. For written permission, + * please contact info@exolab.org. + * + * 4. Products derived from this Software may not be called "Exolab" + * nor may "Exolab" appear in their names without prior written + * permission of Intalio, Inc. Exolab is a registered + * trademark of Intalio, Inc. + * + * 5. Due credit should be given to the Exolab Project + * (http://www.exolab.org/). + * + * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001-2002 (C) Intalio, Inc. All Rights Reserved. + * + */ +package org.codehaus.castor.maven.xmlctf; + +import junit.framework.Test; +import junit.framework.TestResult; +import junit.textui.TestRunner; + +import org.apache.maven.plugin.MojoExecutionException; + +/** + * Uses a simple TextRunner to run the xmlctf tests + * + * @goal xmlctf-text + */ + +public class TextTestSuiteMojo extends AbstractTestSuiteMojo{ + + @Override + public void runJUnit(Test testSuite) throws MojoExecutionException{ + TestResult result = TestRunner.run(testSuite); + if (result.errorCount() > 0 || result.failureCount() > 0) { + throw new MojoExecutionException("Errors or Failures occured testing the MasterTestSuite!"); + } + } + + + +} + + Index: /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins/pom.xml =================================================================== --- /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins/pom.xml (revision 0) +++ /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/maven-plugins/pom.xml (revision 0) @@ -0,0 +1,56 @@ + + 4.0.0 + org.codehaus.castor + castor-maven-plugins + maven-plugin + 1.0-SNAPSHOT + castor-xmlctf-plugin Maven Mojo + http://maven.apache.org + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + + + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.apache.maven + maven-project + 2.0.1 + + + org.codehaus.castor + castor-testsuite-xml-framework + 1.1.3-SNAPSHOT + + + org.codehaus.castor + castor + 1.1.3-SNAPSHOT + + + junit + junit + 3.8.1 + + + oro + oro + 2.0.8 + + + Property changes on: /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf-framework ___________________________________________________________________ Name: svn:ignore - build eclipse + build eclipse target Index: /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf-framework/src/main/java/org/castor/xmlctf/compiler/SunJavaCompiler.java =================================================================== --- /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf-framework/src/main/java/org/castor/xmlctf/compiler/SunJavaCompiler.java (revision 7236) +++ /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf-framework/src/main/java/org/castor/xmlctf/compiler/SunJavaCompiler.java (working copy) @@ -161,12 +161,15 @@ args.add(_javaVersion); } args.add("-classpath"); - args.add(System.getProperty("java.class.path") + ";" + destDir.getAbsolutePath()); + if (System.getProperty("xmlctf.classpath.override") != null) { + args.add(System.getProperty("xmlctf.classpath.override") + ";" + destDir.getAbsolutePath()); + } else { + args.add(System.getProperty("java.class.path") + ";" + destDir.getAbsolutePath()); + } args.add("-d"); args.add(destDir.getAbsolutePath()); args.add("-sourcepath"); args.add(srcDir.getAbsolutePath()); - return args; } Index: /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf-framework/pom.xml =================================================================== --- /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf-framework/pom.xml (revision 7236) +++ /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf-framework/pom.xml (working copy) @@ -30,7 +30,7 @@ 1.4 1.4 - org/exolab/castor/tests/framework/** + org/** Index: /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf/pom.xml =================================================================== --- /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf/pom.xml (revision 7236) +++ /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/xmlctf/pom.xml (working copy) @@ -21,87 +21,40 @@ - - + - org.apache.maven.plugins - maven-compiler-plugin - - 1.4 - 1.4 - - org/exolab/castor/tests/framework/** - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - src/main/resources/META-INF/MANIFEST.MF - - - - - - org.apache.maven.plugins - maven-source-plugin - - true - - - - - - org.apache.maven.plugins - maven-source-plugin + org.codehaus.castor + castor-maven-plugins + test - jar + xmlctf-text - + + + tests/MasterTestSuite/ + - - - - - - - org.apache.maven.wagon - wagon-webdav - 1.0-beta-1 - - - - - - - org.codehaus.castor - castor-codegen - 1.1.1-SNAPSHOT - - - - ant - ant - 1.6 - - - - junit - junit - 3.8.2 - - - - + + + junit + junit + 3.8.1 + + + org.codehaus.castor + castor-testsuite-xml-framework + 1.1.3-SNAPSHOT + + + + + Index: /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/bin/CTFRun.sh =================================================================== --- /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/bin/CTFRun.sh (revision 7236) +++ /Users/matthias/projects/gsc/jira_checouts/castor_maven_plugin3/bin/CTFRun.sh (working copy) @@ -20,7 +20,7 @@ LIB_D=$CASTOR_HOME/lib CLASSPATH=$CASTOR_HOME/xmlctf/build -CLASSPATH=$CLASSPATH:$CASTOR_HOME/xmlctf/build/classes +CLASSPATH=$CLASSPATH:$CASTOR_HOME/xmlctf-framework/build/classes CLASSPATH=$CLASSPATH:$CASTOR_HOME/build/classes CLASSPATH=$CLASSPATH:$CASTOR_HOME/codegen/build/classes CLASSPATH=$CLASSPATH:$BUILD_D/tests