All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.htfv.maven.plugins.testing.internal.MavenTestContext Maven / Gradle / Ivy

package com.github.htfv.maven.plugins.testing.internal;

import java.io.File;
import java.util.List;

import org.apache.maven.project.MavenProject;
import org.sonatype.aether.artifact.Artifact;

import com.github.htfv.maven.plugins.testing.MavenTest;

/**
 * {@link MavenTest} execution parameters.
 *
 * @author htfv (Aliaksei Lahachou)
 */
public class MavenTestContext
{
    /**
     * The basedir of the tested {@link MavenProject}.
     */
    private File basedir;

    /**
     * The tested {@link MavenProject}.
     */
    private MavenProject mavenProject;

    /**
     * The {@link PlexusContainer}.
     */
    private PlexusContainer plexusContainer;

    /**
     * The list of workspace {@link Artifact}s.
     */
    private List  workspaceArtifacts;

    /**
     * Gets the basedir of the tested {@link MavenProject}.
     *
     * @return The basedir of the tested {@link MavenProject}.
     */
    public File getBasedir()
    {
        return basedir;
    }

    /**
     * Gets the tested {@link MavenProject}.
     *
     * @return The tested {@link MavenProject}.
     */
    public MavenProject getMavenProject()
    {
        return mavenProject;
    }

    /**
     * Gets the {@link PlexusContainer}.
     *
     * @return The {@link PlexusContainer}.
     */
    public PlexusContainer getPlexusContainer()
    {
        return plexusContainer;
    }

    /**
     * Gets the list of workspace {@link Artifact}s.
     *
     * @return The list of workspace {@link Artifact}s.
     */
    public List getWorkspaceArtifacts()
    {
        return workspaceArtifacts;
    }

    /**
     * Sets the basedir of the tested {@link MavenProject}.
     *
     * @param basedir
     *            the basedir of the tested {@link MavenProject}.
     */
    public void setBasedir(final File basedir)
    {
        this.basedir = basedir;
    }

    /**
     * Sets the tested {@link MavenProject}.
     *
     * @param mavenProject
     *            the tested {@link MavenProject}.
     */
    public void setMavenProject(final MavenProject mavenProject)
    {
        this.mavenProject = mavenProject;
    }

    /**
     * Sets the {@link PlexusContainer}.
     *
     * @param plexusContainer
     *            the {@link PlexusContainer}.
     */
    public void setPlexusContainer(final PlexusContainer plexusContainer)
    {
        this.plexusContainer = plexusContainer;
    }

    /**
     * Sets the list of workspace {@link Artifact}s.
     *
     * @param workspaceArtifacts
     *            the list of workspace {@link Artifact}s.
     */
    public void setWorkspaceArtifacts(final List workspaceArtifacts)
    {
        this.workspaceArtifacts = workspaceArtifacts;
    }

    /**
     * Tears down the {@link MavenTestContext}.
     *
     * @throws Exception
     *             if the {@link MavenTestContext} could not be teared down.
     */
    public void tearDown() throws Exception
    {
        if (plexusContainer != null)
        {
            plexusContainer.tearDown();
            plexusContainer = null;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy