org.codehaus.modello
Class AbstractModelloJavaGeneratorTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.codehaus.plexus.PlexusTestCase
              extended by org.codehaus.modello.AbstractModelloGeneratorTest
                  extended by org.codehaus.modello.AbstractModelloJavaGeneratorTest
All Implemented Interfaces:
junit.framework.Test

public abstract class AbstractModelloJavaGeneratorTest
extends AbstractModelloGeneratorTest

Base class for unit-tests of Modello plugins that generate java code.

Version:
$Id: AbstractModelloJavaGeneratorTest.java 1416 2010-02-13 22:25:29Z hboutemy $
Author:
Trygve Laugstøl
See Also:
compileGeneratedSources() method to compile generated sources, verifyCompiledGeneratedSources(String) method to run a Verifier class against compiled generated code, Verifier base class for verifiers

Field Summary
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
basedir, container
 
Constructor Summary
protected AbstractModelloJavaGeneratorTest(java.lang.String name)
           
 
Method Summary
protected  void addClassPathFile(java.io.File file)
           
protected  void addDependency(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
           
protected  void assertGeneratedFileExists(java.lang.String filename)
           
protected  void compileGeneratedSources()
           
protected  void compileGeneratedSources(boolean useJava5)
           
protected  void compileGeneratedSources(java.lang.String verifierId)
           
protected  void compileGeneratedSources(java.lang.String verifierId, boolean useJava5)
           
 java.util.List<java.io.File> getClasspath()
           
protected  java.util.List<java.lang.String> getClassPathElements()
           
protected  java.io.File getDependencyFile(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
           
protected  java.lang.String getModelloVersion()
           
protected  java.io.File getOutputClasses()
           
protected  java.io.File getOutputDirectory()
           
protected  void printClasspath(java.net.URLClassLoader classLoader)
           
protected  void setUp()
           
protected  boolean skipJava5FeatureTest()
          Check if a Java 5 feature test should be skipped, since it is not supported by current test environment.
protected  void verifyCompiledGeneratedSources(java.lang.String verifierClassName)
          Run a verifier class in a classloader context where compiled generated sources are available
 
Methods inherited from class org.codehaus.modello.AbstractModelloGeneratorTest
getModelloParameters, getModelloParameters, getModelloParameters, getName, getXmlResourceReader
 
Methods inherited from class org.codehaus.plexus.PlexusTestCase
createContainerInstance, customizeContext, customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getContainer, getCustomConfiguration, getResourceAsStream, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, release, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractModelloJavaGeneratorTest

protected AbstractModelloJavaGeneratorTest(java.lang.String name)
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class AbstractModelloGeneratorTest
Throws:
java.lang.Exception

getOutputDirectory

protected java.io.File getOutputDirectory()
Overrides:
getOutputDirectory in class AbstractModelloGeneratorTest

getOutputClasses

protected java.io.File getOutputClasses()

addDependency

protected void addDependency(java.lang.String groupId,
                             java.lang.String artifactId,
                             java.lang.String version)
                      throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

getDependencyFile

protected java.io.File getDependencyFile(java.lang.String groupId,
                                         java.lang.String artifactId,
                                         java.lang.String version)

getClasspath

public java.util.List<java.io.File> getClasspath()

getModelloVersion

protected java.lang.String getModelloVersion()
                                      throws java.io.IOException
Throws:
java.io.IOException

compileGeneratedSources

protected void compileGeneratedSources()
                                throws java.io.IOException,
                                       org.codehaus.plexus.compiler.CompilerException
Throws:
java.io.IOException
org.codehaus.plexus.compiler.CompilerException

compileGeneratedSources

protected void compileGeneratedSources(boolean useJava5)
                                throws java.io.IOException,
                                       org.codehaus.plexus.compiler.CompilerException
Throws:
java.io.IOException
org.codehaus.plexus.compiler.CompilerException

compileGeneratedSources

protected void compileGeneratedSources(java.lang.String verifierId)
                                throws java.io.IOException,
                                       org.codehaus.plexus.compiler.CompilerException
Throws:
java.io.IOException
org.codehaus.plexus.compiler.CompilerException

compileGeneratedSources

protected void compileGeneratedSources(java.lang.String verifierId,
                                       boolean useJava5)
                                throws java.io.IOException,
                                       org.codehaus.plexus.compiler.CompilerException
Throws:
java.io.IOException
org.codehaus.plexus.compiler.CompilerException

verifyCompiledGeneratedSources

protected void verifyCompiledGeneratedSources(java.lang.String verifierClassName)
                                       throws java.net.MalformedURLException
Run a verifier class in a classloader context where compiled generated sources are available

Parameters:
verifierClassName - the class name of the verifier class
Throws:
java.net.MalformedURLException

addClassPathFile

protected void addClassPathFile(java.io.File file)
                         throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

printClasspath

protected void printClasspath(java.net.URLClassLoader classLoader)

assertGeneratedFileExists

protected void assertGeneratedFileExists(java.lang.String filename)

skipJava5FeatureTest

protected boolean skipJava5FeatureTest()
Check if a Java 5 feature test should be skipped, since it is not supported by current test environment.

Returns:
true if Java 5 is not available, then feature test should be skipped by caller

getClassPathElements

protected java.util.List<java.lang.String> getClassPathElements()


Copyright © 2001-2011 Codehaus. All Rights Reserved.