org.bluestemsoftware.open.eoa.plugin.surefire.UnitTestMojo Maven / Gradle / Ivy
/**
* Copyright 2008 Bluestem Software LLC. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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, see .
*
*/
package org.bluestemsoftware.open.eoa.plugin.surefire;
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
/**
* Executes unit tests. Note that plexus component descriptor included within plugin dist binds
* test phase within default lifecycle to this mojo's test goal.
*
* @goal test
* @phase test
*/
public class UnitTestMojo extends AbstractSurefireMojo {
/**
* The directory containing generated test classes of the project being tested.
*
* @parameter expression="${project.build.testOutputDirectory}"
* @required
*/
private File testClassesDirectory;
/**
* Name of system property, which if set, signals forked jvm, i.e. unit tests fork, to wait
* for a jwdp attachment via port 5005.
*
* @parameter expression="maven.surefire.debug"
* @required
* @readonly
*/
private String debugPropertyName;
/*
* (non-Javadoc)
* @see org.bluestemsoftware.open.eoa.plugin.surefire.AbstractSurefireMojo#getTestClassesDirectory()
*/
protected File getSystemTestClassesDirectory() {
return testClassesDirectory;
}
/*
* (non-Javadoc)
* @see org.bluestemsoftware.open.eoa.plugin.surefire.AbstractSurefireMojo#getTestReportsDirectory()
*/
protected File getTestReportsDirectory() {
return reportsDirectory;
}
/*
* (non-Javadoc)
* @see org.bluestemsoftware.open.eoa.plugin.surefire.AbstractSurefireMojo#isIntegrationTest()
*/
protected boolean isIntegrationTest() {
return false;
}
/*
* (non-Javadoc)
* @see org.bluestemsoftware.open.eoa.plugin.surefire.AbstractSurefireMojo#execute()
*/
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("Tests are skipped.");
return;
}
System.setProperty("basedir", basedir.getAbsolutePath());
super.execute();
}
/*
* defined as a paramater for plugin documentation only. property name is used within
* surefire booter to set debug option when running jvm
*/
protected String getDebugPropertyName() {
return debugPropertyName;
}
/*
* (non-Javadoc)
* @see org.bluestemsoftware.open.eoa.plugin.surefire.AbstractSurefireMojo#getClientTestClassesDirectory()
*/
@Override
protected File getClientTestClassesDirectory() {
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy