public abstract class AbstractMavenProjectTestCase
extends junit.framework.TestCase
| Modifier and Type | Field and Description |
|---|---|
static int |
DELETE_RETRY_COUNT |
static long |
DELETE_RETRY_DELAY |
protected org.eclipse.core.runtime.jobs.Job |
downloadSourcesJob |
protected IMavenConfiguration |
mavenConfiguration |
protected static org.eclipse.core.runtime.IProgressMonitor |
monitor |
private java.lang.String |
oldUserSettingsFile |
protected ProjectRegistryRefreshJob |
projectRefreshJob |
protected java.io.File |
repo |
protected org.eclipse.core.resources.IWorkspace |
workspace |
| Constructor and Description |
|---|
AbstractMavenProjectTestCase() |
| Modifier and Type | Method and Description |
|---|---|
protected static <T> void |
assertContainsOnly(java.util.Set<? extends T> actual,
T... expected)
Assert that provided list only contains specified expected items.
|
protected static void |
assertNoErrors(org.eclipse.core.resources.IProject project) |
protected void |
copyContent(org.eclipse.core.resources.IProject project,
java.io.File from,
java.lang.String to) |
private void |
copyContent(org.eclipse.core.resources.IProject project,
java.io.InputStream contents,
java.lang.String to,
boolean waitForJobsToComplete)
closes contents stream
|
protected void |
copyContent(org.eclipse.core.resources.IProject project,
java.lang.String from,
java.lang.String to) |
protected void |
copyContent(org.eclipse.core.resources.IProject project,
java.lang.String from,
java.lang.String to,
boolean waitForJobsToComplete) |
static void |
copyDir(java.io.File src,
java.io.File dst) |
static void |
copyDir(java.io.File src,
java.io.File dst,
java.io.FileFilter filter) |
protected org.eclipse.core.resources.IProject |
createExisting(java.lang.String projectName,
java.lang.String projectLocation) |
protected org.eclipse.core.resources.IProject |
createProject(java.lang.String projectName,
java.lang.String pomResource) |
protected void |
deleteProject(org.eclipse.core.resources.IProject project) |
protected void |
deleteProject(java.lang.String projectName) |
protected void |
deserializeFromWorkspaceState(IMavenProjectFacade projectFacade)
Nullifies all transient IMavenProjectFacade fields, which should have roughly the same effect as writing it to
workspace state and reading it back after workspace restart.
|
private void |
doDeleteProject(org.eclipse.core.resources.IProject project) |
protected static java.util.List<org.eclipse.core.resources.IMarker> |
findErrorMarkers(org.eclipse.core.resources.IProject project) |
protected static java.util.List<org.eclipse.core.resources.IMarker> |
findMarkers(org.eclipse.core.resources.IProject project,
int targetSeverity) |
protected org.eclipse.jdt.core.IClasspathEntry[] |
getMavenContainerEntries(org.eclipse.core.resources.IProject project) |
protected static java.util.Set<org.eclipse.core.resources.IProject> |
getProjectsFromEvents(java.util.Collection<MavenProjectChangedEvent> events)
Returns a set of projects that were affected by specified collection of events
|
protected org.eclipse.core.resources.IProject |
importProject(java.lang.String pomLocation)
Import a test project into the Eclipse workspace
|
protected org.eclipse.core.resources.IProject |
importProject(java.lang.String pomLocation,
ResolverConfiguration configuration)
Import a test project into the Eclipse workspace
|
protected org.eclipse.core.resources.IProject |
importProject(java.lang.String pomLocation,
ResolverConfiguration configuration,
IProjectCreationListener listener)
Import a test project into the Eclipse workspace
|
protected org.eclipse.core.resources.IProject |
importProject(java.lang.String projectName,
java.lang.String projectLocation,
ProjectImportConfiguration importConfiguration) |
protected org.eclipse.core.resources.IProject |
importProject(java.lang.String projectName,
java.lang.String projectLocation,
ResolverConfiguration configuration) |
protected org.eclipse.core.resources.IProject[] |
importProjects(java.lang.String basedir,
java.lang.String[] pomNames,
ResolverConfiguration configuration)
Import test projects into the Eclipse workspace
|
protected org.eclipse.core.resources.IProject[] |
importProjects(java.lang.String basedir,
java.lang.String[] pomNames,
ResolverConfiguration configuration,
boolean skipSanityCheck)
Import test projects into the Eclipse workspace
|
protected org.eclipse.core.resources.IProject[] |
importProjects(java.lang.String basedir,
java.lang.String[] pomNames,
ResolverConfiguration configuration,
boolean skipSanityCheck,
IProjectCreationListener listener) |
protected void |
injectFilexWagon() |
protected boolean |
isAutoBuilding() |
protected void |
refreshMavenProject(org.eclipse.core.resources.IProject project)
Synchronously refreshes maven project state.
|
private boolean |
requiresMavenExecutionContext() |
void |
runTest() |
protected void |
setAutoBuilding(boolean autobuilding) |
protected void |
setAutomaticallyUpdateConfiguration(boolean update) |
private void |
setBasedirRename(MavenProjectInfo projectInfo) |
protected void |
setUp() |
protected void |
tearDown() |
protected static java.lang.String |
toString(org.eclipse.core.resources.IMarker[] markers) |
protected static java.lang.String |
toString(java.util.List<org.eclipse.core.resources.IMarker> markers) |
protected void |
waitForJobsToComplete() |
static void |
waitForJobsToComplete(org.eclipse.core.runtime.IProgressMonitor monitor) |
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, setName, toStringpublic static final int DELETE_RETRY_COUNT
public static final long DELETE_RETRY_DELAY
protected static final org.eclipse.core.runtime.IProgressMonitor monitor
protected org.eclipse.core.resources.IWorkspace workspace
protected java.io.File repo
protected ProjectRegistryRefreshJob projectRefreshJob
protected org.eclipse.core.runtime.jobs.Job downloadSourcesJob
protected IMavenConfiguration mavenConfiguration
private java.lang.String oldUserSettingsFile
protected void setUp()
throws java.lang.Exception
setUp in class junit.framework.TestCasejava.lang.Exceptionprotected void tearDown()
throws java.lang.Exception
tearDown in class junit.framework.TestCasejava.lang.Exceptionprotected void setAutoBuilding(boolean autobuilding)
throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreExceptionprotected boolean isAutoBuilding()
protected void setAutomaticallyUpdateConfiguration(boolean update)
protected void refreshMavenProject(org.eclipse.core.resources.IProject project)
IMavenProjectRegistry.refresh(Collection, IProgressMonitor)protected void deleteProject(java.lang.String projectName)
throws org.eclipse.core.runtime.CoreException,
java.lang.InterruptedException
org.eclipse.core.runtime.CoreExceptionjava.lang.InterruptedExceptionprotected void deleteProject(org.eclipse.core.resources.IProject project)
throws java.lang.InterruptedException,
org.eclipse.core.runtime.CoreException
java.lang.InterruptedExceptionorg.eclipse.core.runtime.CoreExceptionprivate void doDeleteProject(org.eclipse.core.resources.IProject project)
throws org.eclipse.core.runtime.CoreException,
java.lang.InterruptedException
org.eclipse.core.runtime.CoreExceptionjava.lang.InterruptedExceptionprotected org.eclipse.core.resources.IProject createProject(java.lang.String projectName,
java.lang.String pomResource)
throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreExceptionprotected org.eclipse.core.resources.IProject createExisting(java.lang.String projectName,
java.lang.String projectLocation)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
java.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionprotected org.eclipse.core.resources.IProject importProject(java.lang.String pomLocation)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
pomLocation - - a relative location of the pom file for the project to importjava.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionprotected org.eclipse.core.resources.IProject importProject(java.lang.String pomLocation,
ResolverConfiguration configuration)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
pomLocation - - a relative location of the pom file for the project to importconfiguration - - a resolver configuration to be used to configure imported projectjava.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionprotected org.eclipse.core.resources.IProject importProject(java.lang.String pomLocation,
ResolverConfiguration configuration,
IProjectCreationListener listener)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
pomLocation - - a relative location of the pom file for the project to importconfiguration - - a resolver configuration to be used to configure imported projectlistener - - listener which will get notified of the raw project creationjava.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionprotected org.eclipse.core.resources.IProject[] importProjects(java.lang.String basedir,
java.lang.String[] pomNames,
ResolverConfiguration configuration)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
basedir - - a base directory for all projects to importpomNames - - a relative locations of the pom files for the projects to importconfiguration - - a resolver configuration to be used to configure imported projectsjava.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionprotected org.eclipse.core.resources.IProject[] importProjects(java.lang.String basedir,
java.lang.String[] pomNames,
ResolverConfiguration configuration,
boolean skipSanityCheck)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
basedir - - a base directory for all projects to importpomNames - - a relative locations of the pom files for the projects to importconfiguration - - a resolver configuration to be used to configure imported projectsjava.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionprotected org.eclipse.core.resources.IProject[] importProjects(java.lang.String basedir,
java.lang.String[] pomNames,
ResolverConfiguration configuration,
boolean skipSanityCheck,
IProjectCreationListener listener)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
java.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionprivate void setBasedirRename(MavenProjectInfo projectInfo) throws java.io.IOException
java.io.IOExceptionprotected org.eclipse.core.resources.IProject importProject(java.lang.String projectName,
java.lang.String projectLocation,
ResolverConfiguration configuration)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
java.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionprotected org.eclipse.core.resources.IProject importProject(java.lang.String projectName,
java.lang.String projectLocation,
ProjectImportConfiguration importConfiguration)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
java.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionprotected void waitForJobsToComplete()
throws java.lang.InterruptedException,
org.eclipse.core.runtime.CoreException
java.lang.InterruptedExceptionorg.eclipse.core.runtime.CoreExceptionpublic static void waitForJobsToComplete(org.eclipse.core.runtime.IProgressMonitor monitor)
throws java.lang.InterruptedException,
org.eclipse.core.runtime.CoreException
java.lang.InterruptedExceptionorg.eclipse.core.runtime.CoreExceptionprotected org.eclipse.jdt.core.IClasspathEntry[] getMavenContainerEntries(org.eclipse.core.resources.IProject project)
throws org.eclipse.jdt.core.JavaModelException
org.eclipse.jdt.core.JavaModelExceptionprotected static java.lang.String toString(org.eclipse.core.resources.IMarker[] markers)
protected static java.lang.String toString(java.util.List<org.eclipse.core.resources.IMarker> markers)
protected void copyContent(org.eclipse.core.resources.IProject project,
java.lang.String from,
java.lang.String to)
throws java.lang.Exception
java.lang.Exceptionprotected void copyContent(org.eclipse.core.resources.IProject project,
java.lang.String from,
java.lang.String to,
boolean waitForJobsToComplete)
throws java.lang.Exception
java.lang.Exceptionprotected void copyContent(org.eclipse.core.resources.IProject project,
java.io.File from,
java.lang.String to)
throws java.lang.Exception
java.lang.Exceptionprivate void copyContent(org.eclipse.core.resources.IProject project,
java.io.InputStream contents,
java.lang.String to,
boolean waitForJobsToComplete)
throws org.eclipse.core.runtime.CoreException,
java.io.IOException,
java.lang.InterruptedException
org.eclipse.core.runtime.CoreExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionpublic static void copyDir(java.io.File src,
java.io.File dst)
throws java.io.IOException
java.io.IOExceptionpublic static void copyDir(java.io.File src,
java.io.File dst,
java.io.FileFilter filter)
throws java.io.IOException
java.io.IOExceptionprotected static java.util.List<org.eclipse.core.resources.IMarker> findErrorMarkers(org.eclipse.core.resources.IProject project)
throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreExceptionprotected static java.util.List<org.eclipse.core.resources.IMarker> findMarkers(org.eclipse.core.resources.IProject project,
int targetSeverity)
throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreExceptionprotected static void assertNoErrors(org.eclipse.core.resources.IProject project)
throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreExceptionprotected static java.util.Set<org.eclipse.core.resources.IProject> getProjectsFromEvents(java.util.Collection<MavenProjectChangedEvent> events)
@SafeVarargs
protected static <T> void assertContainsOnly(java.util.Set<? extends T> actual,
T... expected)
protected void injectFilexWagon()
throws java.lang.Exception
java.lang.Exceptionprotected void deserializeFromWorkspaceState(IMavenProjectFacade projectFacade) throws java.lang.IllegalAccessException
java.lang.IllegalAccessExceptionpublic void runTest()
throws java.lang.Throwable
runTest in class junit.framework.TestCasejava.lang.Throwableprivate boolean requiresMavenExecutionContext()