org.apache.maven.dotnet.AbstractUnitTestMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-dotnet-plugin Show documentation
Show all versions of maven-dotnet-plugin Show documentation
A plugin that provides general build and test facilities for .Net projects and solutions
/**
* Maven and Sonar plugin for .Net
* Copyright (C) 2010 Jose Chillan and Alexandre Victoor
* mailto: [email protected] or [email protected]
*
* Sonar is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* Sonar 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
/*
* Created on Apr 23, 2009
*
*/
package org.apache.maven.dotnet;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.dotnet.commons.project.VisualStudioProject;
import org.apache.maven.dotnet.commons.project.VisualStudioSolution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
/**
* A base class for unit test mojo for .Net.
*
* @author Jose CHILLAN Mar 25, 2010
*/
public abstract class AbstractUnitTestMojo extends AbstractDotNetMojo {
/**
* @param solution
* @return
* @throws MojoFailureException
*/
protected List extractTestAssemblies(VisualStudioSolution solution)
throws MojoFailureException {
List projects = solution.getTestProjects();
List testAssemblies = new ArrayList();
for (VisualStudioProject visualProject : projects) {
File generatedAssembly = getGeneratedAssembly(visualProject);
if (generatedAssembly.exists()) {
testAssemblies.add(generatedAssembly);
} else {
getLog().warn("Skipping missing test assembly " + generatedAssembly);
}
}
return testAssemblies;
}
@Override
protected boolean checkExecutionAllowed() throws MojoExecutionException {
Log log = getLog();
String skipTest = System.getProperty("maven.test.skip");
if ("TRUE".equalsIgnoreCase(skipTest)) {
log.info("Skipping Test Execution");
return false;
}
return super.checkExecutionAllowed();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy