protected void addDependency( String groupId, String artifactId ) { File dependencyFile = getDependencyFile( groupId, artifactId ); dependencies.add( dependencyFile ); addClassPathFile( dependencyFile ); }
protected void assertGeneratedFileExists( String filename ) { File file = new File( getOutputDirectory(), filename ); assertTrue( "Missing generated file: " + file.getAbsolutePath(), file.canRead() ); assertTrue( "The generated file is empty.", file.length() > 0 ); }
protected void compileGeneratedSources() throws IOException, CompilerException { compileGeneratedSources( getName() ); }
throws IOException, CompilerException File generatedSources = getOutputDirectory(); File destinationDirectory = getOutputClasses(); addDependency( "junit", "junit" ); addDependency( "org.codehaus.plexus", "plexus-utils" ); addDependency( "org.codehaus.modello", "modello-test" ); classPathElements[0] = getTestPath( "target/classes" ); classPathElements[1] = getTestPath( "target/test-classes" ); File verifierDirectory = getTestFile( "src/test/verifiers/" + verifierId ); String[] sourceDirectories; if ( verifierDirectory.canRead() ) assertEquals( "There was compilation errors: " + errors, 0, errors.size() );
addClassPathFile( getOutputClasses() ); addClassPathFile( getTestFile( "target/classes" ) ); addClassPathFile( getTestFile( "target/test-classes" ) );
protected void setUp() throws Exception { super.setUp(); FileUtils.deleteDirectory( getOutputClasses() ); assertTrue( getOutputClasses().mkdirs() ); }
protected File getDependencyFile( String groupId, String artifactId ) { // NOTE: dependency version is managed by project POM and not selectable by test String libsDir = System.getProperty( "tests.lib.dir", "target/test-libs" ); File dependencyFile = new File( libsDir, artifactId + ".jar" ); assertTrue( "Can't find dependency: " + dependencyFile.getAbsolutePath(), dependencyFile.isFile() ); return dependencyFile; }
protected void compileGeneratedSources( String verifierId ) throws IOException, CompilerException { compileGeneratedSources( verifierId, true ); }
protected String getModelloVersion() throws IOException { Properties properties = new Properties( System.getProperties() ); if ( properties.getProperty( "version" ) == null ) { InputStream is = getResourceAsStream( "/META-INF/maven/org.codehaus.modello/modello-test/pom.properties" ); if ( is != null ) { properties.load( is ); } } return properties.getProperty( "version" ); }
protected void addClassPathFile( File file ) { assertTrue( "File doesn't exists: " + file.getAbsolutePath(), file.exists() ); try { urls.add( file.toURI().toURL() ); } catch ( MalformedURLException e ) { throw new RuntimeException( e ); } classPathElements.add( file.getAbsolutePath() ); }
protected void compileGeneratedSources( boolean useJava5 ) throws IOException, CompilerException { compileGeneratedSources( getName(), useJava5 ); }