Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Piggott2011-01-19 22:40:33 +0000
committervladt2011-01-21 19:14:56 +0000
commit98d1f94dc3681c6cbc82ead5be0298f2e53af938 (patch)
treea24c167d27b5446b043487b5576b29cf427c9275 /org.eclipse.m2e.tests.common
parent77bb6242cb20039cd615142adbccc0fef4c37003 (diff)
downloadm2e-core-98d1f94dc3681c6cbc82ead5be0298f2e53af938.tar.gz
m2e-core-98d1f94dc3681c6cbc82ead5be0298f2e53af938.tar.xz
m2e-core-98d1f94dc3681c6cbc82ead5be0298f2e53af938.zip
MNGECLIPSE-2746 - Added quickfix support for missing configurators and lifecycles
General cleanup on CatalogItem selection code
Diffstat (limited to 'org.eclipse.m2e.tests.common')
-rw-r--r--org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java
index c04bedc9..8b4823ff 100644
--- a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java
+++ b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java
@@ -38,6 +38,7 @@ import org.eclipse.core.runtime.Status;
import org.codehaus.plexus.util.FileUtils;
import org.eclipse.m2e.core.core.IMavenConstants;
+import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
public class WorkspaceHelpers {
@@ -231,4 +232,64 @@ public class WorkspaceHelpers {
return actual;
}
+
+ public static void assertLifecycleIdErrorMarkerAttributes(IProject project, String lifecycleId) throws CoreException {
+ List<IMarker> errorMarkers = WorkspaceHelpers.findErrorMarkers(project);
+ Assert.assertNotNull(errorMarkers);
+ Assert.assertEquals(WorkspaceHelpers.toString(errorMarkers), 1, errorMarkers.size());
+ }
+
+ public static void assertConfiguratorErrorMarkerAttributes(IProject project, String configuratorId)
+ throws CoreException {
+ List<IMarker> errorMarkers = WorkspaceHelpers.findErrorMarkers(project);
+ Assert.assertNotNull(errorMarkers);
+ Assert.assertEquals(WorkspaceHelpers.toString(errorMarkers), 1, errorMarkers.size());
+ assertConfiguratorErrorMarkerAttributes(errorMarkers.get(0), configuratorId);
+ }
+
+ public static void assertLifecyclePackagingErrorMarkerAttributes(IProject project, String packagingType)
+ throws CoreException {
+ List<IMarker> errorMarkers = WorkspaceHelpers.findErrorMarkers(project);
+ Assert.assertNotNull(errorMarkers);
+ Assert.assertEquals(WorkspaceHelpers.toString(errorMarkers), 1, errorMarkers.size());
+ }
+
+ public static void assertLifecycleIdErrorMarkerAttributes(IMarker marker, String lifecycleId) {
+ Assert.assertEquals("Marker's editor hint", IMavenConstants.EDITOR_HINT_UNKNOWN_LIFECYCLE_ID,
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, null));
+ Assert.assertEquals("Marker's lifecycle", lifecycleId,
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_LIFECYCLE_PHASE, null));
+ }
+
+ public static void assertConfiguratorErrorMarkerAttributes(IMarker marker, String configuratorId) {
+ Assert.assertEquals("Marker's ConfiguratorID", configuratorId,
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_CONFIGURATOR_ID, null));
+ Assert.assertEquals("Marker's editor hint", IMavenConstants.EDITOR_HINT_MISSING_CONFIGURATOR,
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, null));
+ }
+
+ public static void assertLifecyclePackagingErrorMarkerAttributes(IMarker marker, String packagingType) {
+ Assert.assertEquals("Marker's editor hint", IMavenConstants.EDITOR_HINT_UNKNOWN_PACKAGING,
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, null));
+ Assert.assertEquals("Marker's packagingType", packagingType,
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_PACKAGING, null));
+ }
+
+ public static void assertErrorMarkerAttributes(IMarker marker, MojoExecutionKey mojoExecution) {
+ Assert.assertEquals(IMavenConstants.EDITOR_HINT_NOT_COVERED_MOJO_EXECUTION,
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, null));
+ //TODO what parameters are important here for the hints?
+ Assert.assertEquals("Marker's groupID", mojoExecution.getGroupId(),
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_GROUP_ID, null));
+ Assert.assertEquals("Marker's artifactId", mojoExecution.getArtifactId(),
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_ARTIFACT_ID, null));
+ Assert.assertEquals("Marker's executionId", mojoExecution.getExecutionId(),
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_EXECUTION_ID, null));
+ Assert.assertEquals("Marker's goal", mojoExecution.getGoal(),
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_GOAL, null));
+ Assert.assertEquals("Marker's version", mojoExecution.getVersion(),
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_VERSION, null));
+ Assert.assertEquals("Marker's lifecyclePhase", mojoExecution.getLifecyclePhase(),
+ marker.getAttribute(IMavenConstants.MARKER_ATTR_LIFECYCLE_PHASE, null));
+ }
}

Back to the top