Author: fbricon
Date: 2011-08-07 18:33:08 -0400 (Sun, 07 Aug 2011)
New Revision: 33655
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/WEB-INF/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/WEB-INF/good-web.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/WEB-INF/web.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JaxRsConfiguratorTest.java
Modified:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF
Log:
JBIDE-9290 : added test for JAXRS configuration errors
Modified:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF 2011-08-07
21:55:24 UTC (rev 33654)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF 2011-08-07
22:33:08 UTC (rev 33655)
@@ -14,6 +14,7 @@
org.jboss.tools.maven.jsf,
org.jboss.tools.maven.portlet,
org.jboss.tools.maven.seam,
+ org.jboss.tools.maven.jaxrs,
org.jboss.tools.maven.ui,
org.eclipse.wst.server.core,
org.jboss.tools.common,
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/pom.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/pom.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/pom.xml 2011-08-07
22:33:08 UTC (rev 33655)
@@ -0,0 +1,15 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.tools.maven.tests</groupId>
+ <artifactId>jaxrs-error</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-core</artifactId>
+ <version>1.7-ea05</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/WEB-INF/good-web.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/WEB-INF/good-web.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/WEB-INF/good-web.xml 2011-08-07
22:33:08 UTC (rev 33655)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <!-- This is a nice comment -->
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>default.html</welcome-file>
+ <welcome-file>default.htm</welcome-file>
+ <welcome-file>default.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/WEB-INF/web.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/WEB-INF/web.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-error/src/main/webapp/WEB-INF/web.xml 2011-08-07
22:33:08 UTC (rev 33655)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
+<web-app id="WebApp_ID">
+ <display-name>jaxrs-error</display-name>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>default.html</welcome-file>
+ <welcome-file>default.htm</welcome-file>
+ <welcome-file>default.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JaxRsConfiguratorTest.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JaxRsConfiguratorTest.java
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JaxRsConfiguratorTest.java 2011-08-07
22:33:08 UTC (rev 33655)
@@ -0,0 +1,68 @@
+package org.jboss.tools.maven.configurators.tests;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jst.common.project.facet.core.JavaFacet;
+import org.eclipse.m2e.core.project.ResolverConfiguration;
+import org.eclipse.m2e.tests.common.WorkspaceHelpers;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.maven.jaxrs.configurators.JaxrsProjectConfigurator;
+import org.jboss.tools.maven.jaxrs.configurators.MavenJaxRsConstants;
+import org.junit.Test;
+
+@SuppressWarnings("restriction")
+public class JaxRsConfiguratorTest extends AbstractMavenConfiguratorTest {
+
+ /*@Test
+ public void testJBIDE9290_supportMultipleJaxRsDependencies() throws Exception {
+ IProject[] projects = importProjects("projects/jaxrs/",
+ new String[]{
+ "jaxrs-jersey/pom.xml",
+ "jaxrs-resteasy/pom.xml"
+ },
+ new ResolverConfiguration());
+ waitForJobsToComplete(new NullProgressMonitor());
+ IProject jersey = projects[0];
+ assertNoErrors(jersey);
+ assertIsJaxRsProject(jersey, JaxrsProjectConfigurator.JAX_RS_FACET_1_1);
+
+ IProject resteasy = projects[1];
+ assertNoErrors(resteasy);
+ assertIsJaxRsProject(resteasy, JaxrsProjectConfigurator.JAX_RS_FACET_1_1);
+
+ }
+ */
+
+
+ @Test
+ public void testJBIDE9290_errorMarkers() throws Exception {
+ String projectLocation = "projects/jaxrs/jaxrs-error";
+ IProject jaxRsProject = importProject(projectLocation+"/pom.xml");
+ waitForJobsToComplete(new NullProgressMonitor());
+ IFacetedProject facetedProject = ProjectFacetsManager.create(jaxRsProject);
+ assertNotNull(jaxRsProject.getName() + " is not a faceted project",
facetedProject);
+ assertFalse("JAX-RS Facet should be missing",
facetedProject.hasProjectFacet(JaxrsProjectConfigurator.JAX_RS_FACET));
+ assertHasJaxRsConfigurationError(jaxRsProject, "JAX-RS (REST Web Services) 1.1 can
not be installed : One or more constraints have not been satisfied.");
+ assertHasJaxRsConfigurationError(jaxRsProject, "JAX-RS (REST Web Services) 1.1
requires Dynamic Web Module 2.3 or newer.");
+
+ //Check markers are removed upon configuration update
+ copyContent(jaxRsProject, "src/main/webapp/WEB-INF/good-web.xml",
"src/main/webapp/WEB-INF/web.xml", true);
+ updateProject(jaxRsProject);
+ assertNoErrors(jaxRsProject);
+ assertIsJaxRsProject(jaxRsProject, JaxrsProjectConfigurator.JAX_RS_FACET_1_1);
+ }
+
+ private void assertHasJaxRsConfigurationError(IProject project, String message) throws
Exception {
+ WorkspaceHelpers.assertErrorMarker(MavenJaxRsConstants.JAXRS_CONFIGURATION_ERROR_MARKER_ID,
message, 1, "", project);
+ }
+
+ private void assertIsJaxRsProject(IProject project,
+ IProjectFacetVersion expectedJaxRsVersion) throws Exception {
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ assertNotNull(project.getName() + " is not a faceted project",
facetedProject);
+ assertEquals("Unexpected JAX-RS Version", expectedJaxRsVersion,
facetedProject.getInstalledVersion(JaxrsProjectConfigurator.JAX_RS_FACET));
+ assertTrue("Java Facet is
missing", facetedProject.hasProjectFacet(JavaFacet.FACET));
+ }
+}