Author: fbricon
Date: 2011-08-12 19:40:36 -0400 (Fri, 12 Aug 2011)
New Revision: 33878
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-2/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-2/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-3/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-3/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/ear/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/ear/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/ear/src/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/ear/src/main/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/ear/src/main/application/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/acme/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/acme/HelloWorldService.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/acme/HelloWorldServiceMBean.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/resources/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/resources/META-INF/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/resources/META-INF/jboss-service.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JBossSarConfiguratorTest.java
Modified:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.project
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF
Log:
JBIDE-9127 : Added maven project configurator for jboss-sar packages
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.project
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.project 2011-08-12
23:34:16 UTC (rev 33877)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.project 2011-08-12
23:40:36 UTC (rev 33878)
@@ -11,17 +11,17 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
+ <name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
+ <name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
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-12
23:34:16 UTC (rev 33877)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF 2011-08-12
23:40:36 UTC (rev 33878)
@@ -15,6 +15,7 @@
org.jboss.tools.maven.portlet,
org.jboss.tools.maven.seam,
org.jboss.tools.maven.jaxrs,
+ org.jboss.tools.maven.jbosspackaging,
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/jboss-sar/jboss-sar-1/pom.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/pom.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/pom.xml 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,33 @@
+<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>jboss-sar-1</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>jboss-sar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.2</version>
+ <!-- Enable packaging types and lifecycle bindings. -->
+ <extensions>true</extensions>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-2/pom.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-2/pom.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-2/pom.xml 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,34 @@
+<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>jboss-sar-2</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>jboss-sar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.2</version>
+ <!-- Enable packaging types and lifecycle bindings. -->
+ <extensions>true</extensions>
+ <configuration>
+ <excludeAll>true</excludeAll>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-3/pom.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-3/pom.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-3/pom.xml 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,37 @@
+<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>jboss-sar-3</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>jboss-sar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.2</version>
+ <!-- Enable packaging types and lifecycle bindings. -->
+ <extensions>true</extensions>
+ <configuration>
+ <excludeAll>false</excludeAll>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/ear/pom.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/ear/pom.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/ear/pom.xml 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,40 @@
+<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>
+ <parent>
+ <groupId>org.jboss.tools.maven.tests</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <groupId>org.jboss.tools.maven.tests</groupId>
+ <artifactId>ear</artifactId>
+ <packaging>ear</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <!--
http://maven.apache.org/plugins/maven-ear-plugin/ -->
+ <version>5</version>
+ <!-- if generateApplicationXml is set to true,
+ maven-ear-plugin adds an invalid <connector> module for the sar in
application.xml
+ and JBoss AS 7 doesn't like it
+ -->
+ <generateApplicationXml>false</generateApplicationXml>
+ <defaultLibBundleDir>lib</defaultLibBundleDir>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.tools.maven.tests</groupId>
+ <artifactId>sar</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <type>sar</type>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/pom.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/pom.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/pom.xml 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.tools.maven.tests</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.5</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.2</version>
+ <!-- Enable packaging types and lifecycle bindings. -->
+ <extensions>true</extensions>
+ <configuration>
+ <excludeAll>true</excludeAll>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <!-- Enable packaging types and lifecycle bindings. -->
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+ <modules>
+ <module>sar</module>
+ <module>ear</module>
+ </modules>
+ <properties>
+ <java.version>1.6</java.version>
+ <app.version>${project.version}</app.version>
+ </properties>
+</project>
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/pom.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/pom.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/pom.xml 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,25 @@
+<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>
+ <parent>
+ <groupId>org.jboss.tools.maven.tests</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>sar</artifactId>
+ <packaging>jboss-sar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging</artifactId>
+ <version>3.0.0.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/acme/HelloWorldService.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/acme/HelloWorldService.java
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/acme/HelloWorldService.java 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,39 @@
+package com.acme;
+
+import org.apache.commons.lang.StringUtils;
+
+
+
+public class HelloWorldService implements HelloWorldServiceMBean
+{
+ // Our message attribute
+ private String message = "Sorry no message today";
+
+ // Getters and Setters
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ // The printMessage operation
+ public void printMessage()
+ {
+ System.out.println(message);
+ }
+
+ // The lifecycle
+ public void start() throws Exception
+ {
+ System.out.println("Démarrage avec le message=" +
StringUtils.reverse(message));
+ }
+
+ public void stop()
+ {
+ System.out.println("Stopping with message=" +
StringUtils.reverse(message));
+ }
+}
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/acme/HelloWorldServiceMBean.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/acme/HelloWorldServiceMBean.java
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/java/com/acme/HelloWorldServiceMBean.java 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,16 @@
+package com.acme;
+
+
+public interface HelloWorldServiceMBean
+{
+ // Configure getters and setters for the message attribute
+ String getMessage();
+ void setMessage(String message);
+
+ // The print message operation
+ void printMessage();
+
+ // Lifecycle callbacks
+ void start() throws Exception;
+ void stop();
+}
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/resources/META-INF/jboss-service.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/resources/META-INF/jboss-service.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/parent/sar/src/main/resources/META-INF/jboss-service.xml 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,20 @@
+<!-- ~ JBoss, Home of Professional Open Source. ~ Copyright 2010, Red Hat,
+ Inc., and individual contributors ~ as indicated by the @author tags. See
+ the copyright.txt file in the ~ distribution for a full listing of individual
+ contributors. ~ ~ This 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 2.1 of ~ the License, or
+ (at your option) any later version. ~ ~ This software 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
+ this software; if not, write to the Free ~ Software Foundation, Inc., 51
+ Franklin St, Fifth Floor, Boston, MA ~ 02110-1301 USA, or see the FSF site:
+
http://www.fsf.org. -->
+<server xmlns="urn:jboss:service:7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:service:7.0 jboss-service_7_0.xsd">
+ <mbean code="com.acme.HelloWorldService"
name="acme.com:service=HelloWorld">
+ <attribute name="Message">Hello World</attribute>
+ </mbean>
+</server>
\ No newline at end of file
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JBossSarConfiguratorTest.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JBossSarConfiguratorTest.java
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JBossSarConfiguratorTest.java 2011-08-12
23:40:36 UTC (rev 33878)
@@ -0,0 +1,135 @@
+package org.jboss.tools.maven.configurators.tests;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+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.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+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.jbosspackaging.configurators.SarProjectConfigurator;
+import org.junit.Test;
+
+@SuppressWarnings("restriction")
+public class JBossSarConfiguratorTest extends AbstractMavenConfiguratorTest {
+
+ @Test
+ public void testBasicSarSupport() throws Exception {
+ IProject project = importProject("projects/jboss-sar/jboss-sar-1/pom.xml");
+ waitForJobsToComplete(new NullProgressMonitor());
+ assertIsSarProject(project);
+
+ IVirtualComponent sarComponent = ComponentCore.createComponent(project);
+ assertNotNull(sarComponent);
+ IVirtualReference[] references = sarComponent.getReferences();
+ assertEquals(1, references.length);
+ assertEquals("commons-lang-2.5.jar", references[0].getArchiveName());
+ assertEquals("/lib", references[0].getRuntimePath().toPortableString());
+
+ IResource[] underlyingResources = getUnderlyingResources(project);
+ assertEquals(1, underlyingResources.length);
+ assertEquals(project.getFolder("/src/main/resources"),
underlyingResources[0]);
+ }
+
+ @Test
+ public void testExcludeAllDependencies() throws Exception {
+ IProject project = importProject("projects/jboss-sar/jboss-sar-2/pom.xml");
+ waitForJobsToComplete(new NullProgressMonitor());
+ assertIsSarProject(project);
+
+ IVirtualComponent sarComponent = ComponentCore.createComponent(project);
+ assertNotNull(sarComponent);
+ IVirtualReference[] references = sarComponent.getReferences();
+ assertEquals(0, references.length);
+ }
+
+ @Test
+ public void testExcludeSomeDependencies() throws Exception {
+ IProject project = importProject("projects/jboss-sar/jboss-sar-3/pom.xml");
+ waitForJobsToComplete(new NullProgressMonitor());
+ assertIsSarProject(project);
+
+ IVirtualComponent sarComponent = ComponentCore.createComponent(project);
+ assertNotNull(sarComponent);
+ IVirtualReference[] references = sarComponent.getReferences();
+ assertEquals(1, references.length);
+ assertEquals("commons-lang-2.5.jar", references[0].getArchiveName());
+ }
+
+ @Test
+ public void testSarInEar() throws Exception {
+ IProject[] projects = importProjects("projects/jboss-sar/parent",
+ new String[] {"pom.xml", "ear/pom.xml", "sar/pom.xml"},
+ new ResolverConfiguration());
+ waitForJobsToComplete(new NullProgressMonitor());
+
+ IProject sar = projects[2];
+ assertIsSarProject(sar);
+
+ IProject ear = projects[1];
+ assertNoErrors(ear);
+
+ IVirtualComponent earComponent = ComponentCore.createComponent(ear);
+ assertNotNull(earComponent);
+ IVirtualReference[] references = earComponent.getReferences();
+ assertEquals(2, references.length);
+ assertEquals("sar-0.0.1-SNAPSHOT.sar", references[0].getArchiveName());
+ assertEquals("/", references[0].getRuntimePath().toPortableString());
+ assertEquals("commons-lang-2.5.jar", references[1].getArchiveName());
+ assertEquals("/lib", references[1].getRuntimePath().toPortableString());
+ }
+
+ // @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 assertIsSarProject(IProject project) throws Exception {
+ IProjectFacetVersion expectedJaxRsVersion =
SarProjectConfigurator.JBOSS_SAR_FACET_VERSION_1_0;
+ assertNoErrors(project);
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ assertNotNull(project.getName() + " is not a faceted project",
facetedProject);
+ assertEquals("Unexpected JBoss SAR Version", expectedJaxRsVersion,
+ facetedProject.getInstalledVersion(SarProjectConfigurator.JBOSS_SAR_FACET));
+ assertTrue("Java Facet is missing",
facetedProject.hasProjectFacet(JavaFacet.FACET));
+ assertTrue("Manifest is missing",
project.getFile("target/classes/META-INF/MANIFEST.MF").exists());
+ }
+
+ protected static IResource[] getUnderlyingResources(IProject project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder root = component.getRootFolder();
+ IResource[] underlyingResources = root.getUnderlyingResources();
+ return underlyingResources;
+ }
+}